-->
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.  [ 4 posts ] 
Author Message
 Post subject: LONG but desperate!!
PostPosted: Wed Oct 19, 2005 9:31 am 
Beginner
Beginner

Joined: Mon Apr 18, 2005 10:25 am
Posts: 38
Location: Maryland
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0

Mapping documents:
These are fine


Code between sessionFactory.openSession() and session.close():
example of one method:

public Role findRole(String role)
{
Session session = HibernateUtil.getSession();
Transaction tx = null;
AnalystDAO anDAO = new AnalystDAO();
Roles retRole = new Roles();

try
{
session.beginTransaction();
retRole = anDA).getRole(session, role);
tx.commit();
session.close();
return retRole;
}
catch (HibernateExeption ex)
{
if (tx != null)
{
tx.rollback();
}
ex.printStackTrace();
}
catch (InfrastructureException ex)
{
if (tx != null)
{
tx.rollback();
}
throw new InfrastructureException(ex);
}
finally
{
session.close();
}
return retRole;
}

HibernateUtil:

public class HibernateUtil
{
private static final SessionFactory sessionFactory;
static
{
try
{
sessionFactory newConfiguration().configure().buildSessionFactory();
}
catch(Throwable ex)
{
ex.printStackTrace();
throw new ExceptionInInitializer(ex);
}
}
public static Session getSession()
{
Session session = null;
try
{
session = sessionFactory.getCurrentSession();
if (session == null)
{
session = sessionFactory.openSession();
}
}
catch (HibernateException ex)
{
ex.printStackTrace();
}
catch (NullPointerException ex)
{
session = sessionFactory.openSession();
}
return session;
}
}



hibernate.cfg.xml:

<session-factory name="java:hibernate/SessionFactory">
<property name="hibernate.connection.datasource">java:SybaseDS</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="hibernate.dialect">org.hibernate.dialect.SybaseDialect</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory </property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
MAPPING FILES

hibernate-service.xml:

<server>
<mbean code="org.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">
<attribute name="DatasourceName">java:/SybaseDS</attribute>
<attribute name="Dialect">org.hibernate.dialect.SybaseDialect</attribute>
<attribute name="SessionFactoryName">java:/hibernate/SessionFactory</attribute>
<attribute name="CacheProviderClass">org.hibernate.cahce.EhCacheProvider</attribute>
<attribute name="ShowSqlEnabled">true</attribute>
</mbean>
</server>
Full stack trace of any exception that occurs:
There is not one to print but we seem to run fine for hours then things start going haywire. A number of connections are being left hanging open on the dbServer even though it seems that we are closing everything. We end up with a JTAException.
Name and version of the database you are using:
Sybase ASE 12.5.2

Debug level Hibernate log excerpt:
Debug

the call in HibernateUtil to getCurrentSession never succeeds so we are always calling openSession. We are always throwing a nullpointerexception and then make the call to openSession. I believe the root of my problem has to be that the JTATransaction stuff is not setup correctly so that is not being used. I am NOT using EJB but just java and DAO pattern.

I want to the jboss container to handle all of the open, close, flush commit and rollbacks but it is not working. I am desperate at this point and can't get this figured out. Is there somewhere specific that I need to configure JTA within JBoss? I didn't find anywhere myself.


Top
 Profile  
 
 Post subject: sybase
PostPosted: Thu Oct 20, 2005 4:12 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
There might be problem in Sybase JDBC driver:
http://forge.objectweb.org/tracker/inde ... tid=100059

Try using drivers from DataDirect and see if that will help

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: loaded the data direct driver per your suggestion
PostPosted: Wed Mar 08, 2006 11:17 am 
Beginner
Beginner

Joined: Mon Apr 18, 2005 10:25 am
Posts: 38
Location: Maryland
This post was from a while ago but we finally got customer approval to get the DD driver to fix our Sybase issues. Now, can you provide a straight forward sample on how to use the JTA with JBOss and hibernate optimally? I posted a post but have not gotten a response yet. Time is of the essence and I would grealy appreciate your input. Feel free to email me directly if you wish: jacky@itmc-wo.com.

Its been so long and we did so much work around coding that I am unsure of the correct look of our hibernate.cfg.xml, hibernate -service.xml and my HibernateUtil helper class.


Top
 Profile  
 
 Post subject: ?
PostPosted: Fri Mar 10, 2006 1:31 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
I am sorry, but your question is a bit vague. Could you be more specific on what issues in what circumstances do you have?
Otherwise I can only direct you to general documentation on Hibernate and JBoss integration like this
http://www.jboss.org/wiki/Wiki.jsp?page=JBossHibernate

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.