• 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.
-id (PK)
-other columns
-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 ]
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!