-
1. Re: getSession
beyarecords May 20, 2005 3:05 PM (in response to garbett)Shawn,
on a slightly different note, I saw an earlier post of yours where you changed the hbm.xml files DTD from 2 to 3. Can you please tell me how your hibernate.har and jboss-hibernate.deplayer is setup as I can't get my hibernate.har to deploy at all.
I have changed all mapping files and class files to reflect the changes required for hibernate3 to work, but whe it comes to starting Jboss hibernate.har doesn't deploy at all. Any ideas?
many thanks
beya -
2. Re: getSession
garbett May 20, 2005 5:42 PM (in response to garbett)There are two other issues bouncing around about Hibernate3. The configuration as currently packaged ends up with two different copies of the Hibernate jar files. Delete one, and put the other in in the common lib directory.
The other issue is more complicated and involves the fact the Hibernate opens the session with no auto flush. One has to flush explicitly.
I'll reply in full tomorrow.
Shawn -
-
4. Re: getSession
starksm64 May 23, 2005 8:56 AM (in response to garbett)Use a resource-ref to avoid hard-coded jndi names.
-
5. Re: getSession
luca.mandorlo May 23, 2005 1:03 PM (in response to garbett)"scott.stark@jboss.org" 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!!!