[jboss-user] [EJB/JBoss] - CMT and EJB 3 Question (Urgent).

grdzeli_kaci do-not-reply at jboss.com
Sun Nov 25 07:12:32 EST 2007


hi all,
i have simplest ejb 3 session bean :

  | @Stateless
  | @Remote(TestFasade.class)
  | public class TestFasadeBean implements TestFasade {
  | 
  | 	@PersistenceContext(unitName = "Oracle")
  | 	EntityManager oracleManager;
  | 
  | 	@TransactionAttribute(TransactionAttributeType.REQUIRED)
  | 	public Long create() {
  | 		try {
  | 			System.out.println("start creating");
  | 			Test test = comit();
  | 			Thread.sleep(10000);
  | 			System.out.println("end creating");
  | 			return test.getId();			
  | 		} catch (Exception e) {
  | 			e.printStackTrace();
  | 			return 0L;
  | 		}
  | 	}
  | 
  | 	@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
  | 	public Test comit() {
  | 		try {
  | 			System.out.println("start persisting");
  | 			Test test = new Test();
  | 			test.setAge(21L);
  | 			test.setName("adsdasd");
  | 			test.setSurname("asdasd");
  | 			oracleManager.persist(test);
  | 			oracleManager.flush();
  | 			System.out.println("end persisting");
  | 			return test;
  | 		} catch (Exception e) {
  | 			e.printStackTrace();
  | 			return null;
  | 		}
  | 	}
  | }
  | 
i need that after a comit() method information must be visible into database, this is not work. i see information into database after 10 second. why ? can anybody help?
is it possible to do by transaction demarcation? or how i can do it ?

i need to flush information after commit method ends.

any idea will be appreciated.

______________
Regards,
Paata.






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

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



More information about the jboss-user mailing list