Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0
Mapping documents:
<class name="Driver" table="driver">
<id name="deviceSerialNumber" type="java.lang.String" column="driver_serial_number" >
<generator class="assigned" />
</id>
<joined-subclass name="MyDriver" table="Mydrive" extends="Driver">
<key column="driver_serial_number" />
</joined-subclass>
</class>
Code between sessionFactory.openSession() and session.close():
public class TestObjLayer {
public static void main(String[] args) {
TestObjLayer.testThread("MS1302");
TestObjLayer.testThread("MS1303");
}
public static void testThread(final String barcode) {
new Thread() {
public void run() {
System.out.println("Starting thread ID ---"
+ Thread.currentThread().getName());
Session sess = factory.openSession();
Transaction tx;
try {
tx = sess.beginTransaction();
//update some field.
//update the object.
...
tx.commit();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally {
sess.close();
}
}
}.start();
}
}
Full stack trace of any exception that occurs:
Name and version of the database you are using: ingres r 3
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I have a joined-subclass relationship between 2 classes. When i use multiple threads to retrieve and save different objects simultaneously both the threads hang when they reach session.commit(). There is no exception. Finally i have to kill both the threads. There is definitely some dead lock condition, which I am not able to figure out.
Any help is greatly appreciated.
Thanks.