-
hibernate. save one to many
I have a 2 table named A and B which are one to many relationship. I can not successfully add the data to table A and B at the same time. The problem is how can i make the foreign key in table B same with the primary key in table A. It only work when i explicitly assign the foreign key to it but how do i know the primary key at this stage because the "a" object have not added to the database. How to solve it?
a.setBs(b);
session.save(a);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks