Hi ,
 
  Thanks for you reply.

 I would like to know whether it is possible to persist the parent child 
entities and expect the results that i am expecting when:

 1. child has a composite primary key that has a FK to the parent's table
     
      PK : keyId + id   (parent table's primary key)
      
 2. "id" which is a FK and part of child's PK is a sequence number and is 
generated only when the parent record is inserted in the DB.

 3. Both keyId and id are non nullable fields of the child table.

  4. when i define bi-directional relation i don't see any exceptions and there 
is no insert SQL generated for the child table. but when i define only 
@OneToMany in parent entity i see the parent record insert SQL and update SQL 
for the child record which may be the update for the parent child relation. and 
an exception soon after the update is executed. 
following is the stack trace..

[SQL] update EVENT_INFO set ID=? where ID=? and keyId=?
[AbstractBatcher] preparing statement
[IntegerType] binding '885218' to parameter: 1
11:53:32,959 ERROR [AbstractFlushingEventListener] Could not synchronize 
database state with session
org.hibernate.TransientObjectException: object references an unsaved transient 
instance - save the transient instance before flushing: 
com.xo.olb.business.entity.EventInfo
        at 
org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:216)
        at org.hibernate.type.EntityType.getIdentifier(EntityType.java:107)
        at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:65)
        at 
org.hibernate.persister.collection.AbstractCollectionPersister.writeElement(AbstractCollectionPersister.java:654)
        at 
org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:927)
.......

but where is the insert record for the child gone..?

Also Could you please give me the details of the bug you were refering to ..?

Thanks
  


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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to