[jboss-user] [JBoss Seam] - Transaction confusion

dustismo do-not-reply at jboss.com
Tue May 22 16:04:47 EDT 2007


Hello,

My end goal is to have multiple db transactions within a single action method
(similar to: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=107449)

I am using pojo with seam annotations, and I cant seem to get anything to work, and am getting very confused.

for instance, I want to create have a method that tests rollback:

  | @Rollback
  | public void testRollback() {
  | 		EmailAddr email = new EmailAddr();
  | 		email.setEmail("test at test.com");
  | 		this.entityManager.persist(email);
  | }
  | 

This is always commited?!?  Shouldn't it rollback?  

Ultimately I would like to do something like:


  | private void insertEmail(EmailAddr addr) {
  | //start transaction
  | this.entityManager.persist(email);
  | //end transaction
  | }
  | 
  | public void insertEmails() {
  | for (EmailAddr addr : emails) {
  | insertEmail(addr);
  | }
  | }
  | 

I've read everything in the forum, and in the hibernate book, but I still can't figure out how to do this.  Any help?

thanks,
Dustin

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

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



More information about the jboss-user mailing list