-->
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: Transactions hanging
PostPosted: Mon Aug 01, 2005 9:56 am 
Newbie

Joined: Fri Mar 04, 2005 4:27 pm
Posts: 13
I query via SQL and session beans but use Hibernate as the persistence part of the application I use the HibernateUtil class on pg. 301 of 'Hibernate In Action'.

When I try to update a record via Hibernate the application freezes on the transaction commit statement. No exceptions, no erors no nothing. I really don't know where to start. Suggestions please!!

Hibernate version: 3.0.5

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>

<class
name="com.sosstaffing.soar.hibernate.contacts.Contact"
table="CONTACTS"
>

<id
name="lrn"
column="LRN"
type="long">
<generator class="sequence">
<param name="sequence">seqcontacts</param>
</generator>
</id>

<property
name="posType"
column="POS_TYPE"
type="java.lang.String"
length="39"
/>
<property
name="name"
column="NAME"
type="java.lang.String"
length="39"
/>
<property
name="position"
column="POSITION"
type="java.lang.String"
length="39"
/>
<property
name="email"
column="EMAIL"
type="java.lang.String"
length="49"
/>
<property
name="address1"
column="ADDRESS1"
type="java.lang.String"
length="49"
/>
<property
name="address2"
column="ADDRESS2"
type="java.lang.String"
length="49"
/>
<property
name="city"
column="CITY"
type="java.lang.String"
length="49"
/>
<property
name="st"
column="ST"
type="java.lang.String"
length="5"
/>
<property
name="zip"
column="ZIP"
type="java.lang.String"
length="11"
/>
<property
name="notes"
column="NOTES"
type="java.lang.String"
length="49"
/>
<property
name="reference"
column="REFERENCE"
type="java.lang.String"
length="19"
/>


</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
mHibSession = HibernateHelper.getSession();
// Make sure no one else has modified this while
// we were working on it.
List<Contact> dbContacts = mHibSession.createCriteria(Contact.class)
.add(Restrictions.eq("lrn", lrn)).list();

if (!dbContacts.isEmpty() && !(((Contact)dbContacts.get(0)).hashCode() == hash))
{
// Someobne modified the data in the database before we could
// write our changes back.
final DataHasChangedException changed = new DataHasChangedException();
changed.setMSidekick((Contact)dbContacts.get(0));
Throw.ejb(HBM_DATA_CHANGED, changed);
}
// Since both of the objects have the same LRN we must close the
// session and open a new one or Hibernate will know that there
// are duplicate objects in the same session and throw an exception.
mHibSession.close();

mHibSession = HibernateHelper.getSession();

HibernateHelper.beginTransaction();
try
{
mHibSession.saveOrUpdate(obj);
HibernateHelper.commitTransaction(); <-- freezes here
}
catch (Exception e)
{
HibernateHelper.rollbackTransaction();
Throw.ejb(HBM_CANT_UPDATE, e);
}
finally
{
mHibSession.flush();
mHibSession.clear();
mHibSession.close();
}


Full stack trace of any exception that occurs:no exceptions

Name and version of the database you are using: Oracle 9i

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Here's my HAR file:

<server>
<mbean code="org.hibernate.jmx.HibernateService"
name="jboss.jca:service=HibernateFactory, name=HibernateFactory">

<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=DataSource</depends>

<attribute name="MapResources">
com/sosstaffing/soar/hibernate/access/Lookup.hbm.xml,
com/sosstaffing/soar/hibernate/orders/Order.hbm.xml,
com/sosstaffing/soar/hibernate/orders/Orderassign.hbm.xml,
com/sosstaffing/soar/hibernate/orders/Orderdetail.hbm.xml,
com/sosstaffing/soar/hibernate/customers/Customer5.hbm.xml,
com/sosstaffing/soar/hibernate/customers/Customer8.hbm.xml,
com/sosstaffing/soar/hibernate/customers/Customer10.hbm.xml,
com/sosstaffing/soar/hibernate/employee/Employee.hbm.xml,
com/sosstaffing/soar/hibernate/employee/Employee2.hbm.xml,
com/sosstaffing/soar/hibernate/contacts/Contact.hbm.xml,
com/sosstaffing/soar/hibernate/contacts/Phone.hbm.xml
</attribute>
<attribute name="JndiName">
java:/hibernate/HibernateSessionFactory
</attribute>
<attribute name="Datasource">
java:/jdbc/OracleDS
</attribute>
<attribute name="Dialect">
org.hibernate.dialect.Oracle9Dialect
</attribute>
<attribute name="TransactionStrategy">
org.hibernate.transaction.JTATransactionFactory
</attribute>
<attribute name="TransactionManagerLookupStrategy">
org.hibernate.transaction.JBossTransactionManagerLookup
</attribute>
<attribute name="ShowSqlEnabled">
true
</attribute>
</server>

Any help would be greatly appreciated.

JG[/b]


Top
 Profile  
 
 Post subject: Transactions Hanging
PostPosted: Mon Aug 01, 2005 3:56 pm 
Newbie

Joined: Fri Mar 04, 2005 4:27 pm
Posts: 13
Nevermind, it was a database issue. Restart cleaned up everything.


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.