[jboss-user] [EJB 3.0] - Exception on trying to persist more than one object

jaki do-not-reply at jboss.com
Fri Aug 15 09:32:44 EDT 2008


I get the following exception on trying to persist more than one bean object: 

anonymous wrote : 
  | Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.um2.mauction.entity.Enchere.bidder -> com.um2.mauction.entity.Utilisateur
  | 	at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:353)
  | 	at org.hibernate.engine.Cascade.cascade(Cascade.java:139)
  | 	at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
  | 	at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
  | 	at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
  | 	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
  | 	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
  | 	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
  | 	at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
  | 	... 48 more
  | 

The objects to be added are related to each other via foreign keys so I'm guessing it's because a dependent object can't find the parent object in the database (which is getting persisted just above in the same function). Anyway to remedy this behaviour?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170757#4170757

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170757



More information about the jboss-user mailing list