aspose file tools*
The moose likes Object Relational Mapping and the fly likes EJB 3.0 insert data to more than 2 tables with one transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "EJB 3.0 insert data to more than 2 tables with one transaction" Watch "EJB 3.0 insert data to more than 2 tables with one transaction" New topic
Author

EJB 3.0 insert data to more than 2 tables with one transaction

nis siv
Greenhorn

Joined: Oct 28, 2009
Posts: 5

We are using EJB3.0 + entities
in our project we need to save data to 3 to 5 tables.
They have relationship(one to many like ...).

can anyone please suggest a method to insert data to all the tables using one transaction .

(instead insert in master then merge detail then child of second ).


Thanks,

Nis
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I don't follow the question - if your DAO code is called from an EJB method that uses CMT it will all be in one transaction. Am I missunderstanding what you are asking?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
nis siv
Greenhorn

Joined: Oct 28, 2009
Posts: 5
if there is some master child relationship between tables using the named query we can get all the data satisfying our criteria .like this is there any facility to insert the values using named query
Moayad Abu Jaber
Ranch Hand

Joined: Jan 15, 2008
Posts: 80
you should put cascade attribute in your relationship annotation.

you can see this site he explain what you want exactly.

Best Regards,
Moayad Abu Jaber
SCJP 5.0, SCWCD 1.4, SCBCD 5.0
nis siv
Greenhorn

Joined: Oct 28, 2009
Posts: 5
Thanks for your reply !!
Do you have any other samples .
using list and all
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB 3.0 insert data to more than 2 tables with one transaction