Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Table Data Persistence

 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two tables login and buyer. PK(Primary Key) of login table is FK(Foreign Key) in buyer table.Below is the table schema.
Login
-id (PK)
-other columns
Buyer
-id (PK)
-loginid (FK)
-other columns

I am using Spring and Hibernate.What I want to know that as this two tables are related with each other, is it possible to persist them in one DB query. Like I prepare both the tables and then I will persist only Login table so that the Buyer table will also be persisted.

I have extended HibernateDaoSupport class and I am using SaveorUpdate() method of Hibernate Session.

PS:- I have tried doing that but I am able to persist only Login.
I have done similar things in EJB3 successfully. I have persisted 5 tables at one shot.
[ December 14, 2008: Message edited by: Vishal Pandya ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic