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

breako do-not-reply at jboss.com
Mon Dec 31 07:19:06 EST 2007


"evdelst" wrote : 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).
  | 
  | 
Thanks for that, food for thought.

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116167



More information about the jboss-user mailing list