This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Userid (PK) –-Foreign Key to the above
In my app I create a new UserAccountInvocie object which I persist by doing a session,save(useraccount) I get an error saying
Cannot intert null into UserAccountInvoiceTable for field UserID
NOTE: there are a number of USERACCOUNTInvoice objects in a SET in the USERACCOUNT object. So ideally saving parent will cascade down to child changes
Is there a way of mapping the relationship in the XML so Hibernate knows to use the userID of the parent UserAccount object. I don’t think I should set the userID in USERACCOUNTInvoice manually as I think Hibernate will get very confused if I partially set the composite key. And I don’t want to loop through a the child set and save new USERACCOUNTInvoice either. Unless I have too?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Hibernate - Force foreign key lookup on insert