users@glassfish.java.net

JoinTable not always updated!!!???

From: <glassfish_at_javadesktop.org>
Date: Fri, 22 Jun 2007 18:05:36 PDT

I only see rows added to my join table sometimes when persisting data. That's really messed up.

Definition:
Tried both ways with explicit jointable and the default both only update sometimes.
@OneToMany(cascade={CascadeType.ALL})
   /*
   @JoinTable(
      name="garage_to_updates_join_table",
      joinColumns={_at_JoinColumn(name="GARAGE_ID")},
      inverseJoinColumns={_at_JoinColumn(name="GARAGE_UPDATE_ID")}
   )
   */
   public Collection<GarageUpdateEntityBean> getGarageUpdates()
   {
      return garageUpdates;
   }

Persisting done in message bean using a lookup and adding to the collection:

GarageEntityBean targetBean =
               garageEntityBeanFacade.find( gu.getGarageName() );
            
            if( targetBean == null )
            {
               // No matching garage for this update.
               return;
            }
            
            // Create a new entry
            GarageUpdateEntityBean ge = new GarageUpdateEntityBean();
            ge.setGarageName( gu.getGarageName() );
            ge.setUsageCount( gu.getCurrentCount() );
            
            targetBean.getGarageUpdates().add( ge );

There is always a match here and I always see my GarageUpdateEntityBean table updated with the new records. But the jointable is not always updated with these new records and I lose data as a result of this?? Why is this happening?
[Message sent by forum member 'samdoyle' (samdoyle)]

http://forums.java.net/jive/thread.jspa?messageID=223624