-
1. Re: Newly created identity not propagated to dependent colum
mwoelke Jan 22, 2006 9:06 AM (in response to rbenko)I think your error is, that all your annotation are connected to the fields.
if you try changing the way the container is accessing your annotations (@Entity(access=...)) it sould be working. Of course you could put your annotations to the properties as well.@Id(generate=GeneratorType.AUTO) public int getId(){ return id; }
hope i could help you.
regards, milan wölke -
2. Re: Newly created identity not propagated to dependent colum
rbenko Jan 22, 2006 9:32 AM (in response to rbenko)Thanks for the reply. I left out (access=AccessType.FIELD) in the @Entity annotation - I do use that.
I'll try and explain further - it seems that JBoss/Hibernate are generating the correct INSERT statements for the Entities, but it is not propagating the newly created Identity value for the WidgetHolder row to the Widget rows. Using the trace, I see it is properly formatting the inserts, and even adding a "select scope_identity()" to the end of the insert statement to have SQL Server return the newly created ID - however, Hibernate is not using that value in the subsequent INSERT statement for the Widgets. Very frustrating. -
3. Re: Newly created identity not propagated to dependent colum
martinganserer Jan 23, 2006 5:46 AM (in response to rbenko)Hello,
I think it won't work as long as you try to perist a whole list.
Try this:for(Widget widget: widgetHolder) { em.persist(widget); }