If you are using EJB3 I recommend using a persistence.xml file.
such as...
<persistence-unit name="metadata">
<jta-data-source>java:/it</jta-data-source>
org.hibernate.ejb.HibernatePersistence
</persistence-unit>
In your ejb instead of trying to create a jdbc connection use the annotation in your ejb
@PersistanceUnit(unit="metadata")
EntityManagerFactory factory
in your method you can access the query object such as
EntityManager em = factory.createEntityManager
Query query = em.whatYouNeedToDo...
Or if you need more advance features of the Hibernate Query object
//in your ejb or where you need it.
private EntityManagerFactory factory = new
HibernatePersistence().createEntityManagerFactory(GUI, new HashMap());
in your method
Session session = session =
((HibernateEntityManagerFactory)factory).getSessionFactory().getCurrentSession();
HTH
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044697#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...