-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: hibernate session in glassfish 2.1
PostPosted: Wed Jan 13, 2010 4:08 pm 
Beginner
Beginner

Joined: Wed Dec 16, 2009 10:34 am
Posts: 21
Helllo:
i was wondering hoe can i get the hibernate sesison in glassfish 2.1 ??

i've been trying this code:

Quote:
public class HibernateSessionFactoryUtil
{
private static final SessionFactory sessionFactory;

static
{
try
{
sessionFactory = new Configuration().configure().buildSessionFactory();
}
catch (Throwable ex)
{
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}

public static SessionFactory getSessionFactory()
{
return sessionFactory;
}
}


but when im using the getSessionFactory method , i get the following message:

javax.ejb.EJBException: Stateless SessionBean method returned without completing transaction
at com.sun.ejb.containers.BaseContainer.checkExceptionBeanMgTx(BaseContainer.java:3689)


Top
 Profile  
 
 Post subject: Re: hibernate session in glassfish 2.1
PostPosted: Wed Jan 13, 2010 5:03 pm 
Beginner
Beginner

Joined: Wed Dec 16, 2009 10:34 am
Posts: 21
Hello:

i found that my problem is that the application cannot find the hibernate.cgf.xml file. That's because im using just the annotations and the entitymanager to use them with JPA.
Now the real question is:

How can i get the hibernate session from the entitymanager ? (if it's possible)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.