"[EMAIL PROTECTED]" wrote : Use a resource-ref to avoid hard-coded jndi names.
I try to use a resource-ref for accesing to java:/hibernate/SpikeSessionFactory
called hibernate.
Deployment is ok, but SessionFactory object in null again!!!
this i the code:
InitialContext context = null;
| context = new InitialContext();
| SessionFactory factory =
(SessionFactory)context.lookup("java:comp/env/hibernate");
| Session hsession = factory.openSession();
and in ejb-jar.xml
<ejb-jar>
| <enterprise-beans>
| <session>
| <description>Timer Example session bean</description>
| <display-name>Timer Example SessionBean</display-name>
| <ejb-name>TimerExample</ejb-name>
| <home>it.fastweb.spike.timer.TimerExampleHome</home>
| <remote>it.fastweb.spike.timer.TimerExample</remote>
| <ejb-class>it.fastweb.spike.timer.TimerExampleBean</ejb-class>
| <session-type>Stateless</session-type>
| <transaction-type>Container</transaction-type>
| <resource-ref>
| <res-ref-name>hibernate</res-ref-name>
| <res-type>org.hibernate.SessionFactory</res-type>
| <res-auth>Container</res-auth>
| </resource-ref>
| </session>
| </enterprise-beans>
|
| <assembly-descriptor>
|
| <container-transaction>
| <method>
| <ejb-name>TimerExample</ejb-name>
| <method-name>*</method-name>
| </method>
| <trans-attribute>Required</trans-attribute>
| </container-transaction>
|
| </assembly-descriptor>
| </ejb-jar>
in jboss.xml
<resource-managers>
| <resource-manager>
| <res-name>hibernate</res-name>
|
<res-jndi-name>java:/hibernate/SpikeSessionFactory</res-jndi-name>
| </resource-manager>
| </resource-managers>
Why the SessionFactory is null??? i'm gone crazy!!!
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3878777#3878777
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3878777
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user