Java Mailing List Archive

http://www.junlu.com/

Home » JBoss User »

[jboss-user] [JBoss Seam] - Re: Creating several objects in one
 transaction.

manik.surtani@jboss.com

2007-12-30


Author LoginPost Reply
Easiest is to add the persons to a list you store in the bean.

eg.

private Person person;
|
| private List<Person> list=new ArrayList<Person>();
|
| void add() {
|   list.add(person);
|  person = new Person();
| )

Then in your commit method, iterate the list and call em.persist for each element.
No need to use Flushmode.manual for this kind of interaction.
Also, the transaction is tied to a single method call (= a good thing).



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116110#4116110

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116110
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.