Uploaded image for project: 'EJB 3.0'
  1. EJB 3.0
  2. EJBTHREE-101

EntityManager not useable in PostConstruct callback of StatelessSessionBean.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • Preview 5
    • Preview 4
    • None
    • None
    • JBoss-4.0.1sp1, EJB3-Preview4, Windows 2000.

      When trying to use the entity manager for a query in a PostConstruct callback in a StatelessSessionBean, execution fails with:

      Caused by: java.lang.RuntimeException: EntityManager must be access within a transaction
      at org.jboss.ejb3.entity.HibernateSessionFactory.getSession(HibernateSessionFactory.java:105)
      at org.jboss.ejb3.entity.EntityManagerImpl.getSession(EntityManagerImpl.java:146)
      at org.jboss.ejb3.entity.EntityManagerImpl.createQuery(EntityManagerImpl.java:39)
      at some.package.postConstructCallback(SomeDAOBean.java:99)
      ... 26 more

              kkhan1@redhat.com Kabir Khan
              shagoon_jira Shagoon (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: