[ http://jira.jboss.com/jira/browse/EJBTHREE-101?page=history ]
Kabir Khan closed EJBTHREE-101:
-------------------------------
Resolution: Rejected
I think it is fine. From spec:
3.4 Callbacks and Callback Listener Classes
...
Callbacks can invoke JNDI, JDBC, JMS, and other EJBs, but not the
EntityManager. [Note:
This will be more closely defined for session beans and message-driven beans in
synch with
Tables 2, 4, 13 in the Enterprise JavaBeans Core Contracts and Requirements
specification
document.]
...
4.1.4 Callbacks for Stateless Session Beans
The following lifecycle event callbacks are supported for stateless session
beans:
â PostConstruct
â PreDestroy
The PostConstruct callback occurs after any dependency injection has been
performed by the container
and before the first business method invocation on the bean.[3]
The PostConstruct method is invoked in an unspecified transaction context and
security context.
The PreDestroy callback occurs at the time the bean instance is destroyed.[4]
The PreDestroy method executes in an unspecified transaction and security
context.
> EntityManager not useable in PostConstruct callback of StatelessSessionBean.
> ----------------------------------------------------------------------------
>
> Key: EJBTHREE-101
> URL: http://jira.jboss.com/jira/browse/EJBTHREE-101
> Project: EJB 3.0
> Type: Bug
> Versions: Preview 4
> Environment: JBoss-4.0.1sp1, EJB3-Preview4, Windows 2000.
> Reporter: Shagoon
> Assignee: Kabir Khan
> Fix For: Preview 5
>
>
> 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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development