This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple Table Data Persistence  RSS feed

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 ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!