[jboss-user] [JBoss Seam] - Fundamental question about em.persist

vanyatka do-not-reply at jboss.com
Sat Dec 8 14:23:56 EST 2007


Hi,

Is there any functional difference between these two snippets (note the order of the last two statements)? When I look at the DB tables in the first case the name of the Card is null. Why so? I was dead sure any changes made to persistent object are flushed at the end of the transaction, so those two examples should give the same result. Everything is as expected in the second, the name of the Card is set properly.

Can anyone comment on this?
Thanks,


  | @Name("initDBBean")
  | @Scope(ScopeType.APPLICATION)
  | public class InitDBBean {
  | 	@Create
  | 	@Transactional
  | 	public void init() {
  | 			Card card = new Card();
  | 			entityManager.persist(card);
  | 			card.setName("cardname");
  | 		}
  | 	}
  | }
  | 


  | @Name("initDBBean")
  | @Scope(ScopeType.APPLICATION)
  | public class InitDBBean {
  | 	@Create
  | 	@Transactional
  | 	public void init() {
  | 			Card card = new Card();
  | 			card.setName("cardname");
  | 			entityManager.persist(card);
  | 		}
  | 	}
  | }
  | 

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

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



More information about the jboss-user mailing list