[jboss-user] [JBoss Seam] - Re: Initialization code

Sammy8306 do-not-reply at jboss.com
Fri Apr 13 05:08:55 EDT 2007


Thanks! One problem though


  | @Startup
  | public class PopulateDB
  | {
  |    @In
  |    private EntityManager em;
  | 
  |    @Create
  |    public void populateDB(){
  |       em.beginTransaction();
  |       CreateTestData.createData(em);
  |    }
  | }
  | 

Leads to this exception: javax.persistence.TransactionRequiredException: no transaction is in progress

I can't start a transaction from the EntityManager either: using getTransaction().begin() gives this exception: java.lang.IllegalStateException: JTA EntityManager cannot access a transactions

And yes, I am aware of the import.sql mechanism, however doing it programmatically would help me tremendously in my setting. Any ideas?

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

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



More information about the jboss-user mailing list