Hibernate version:
2.1.6
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>
<!--
Created by the Middlegen Hibernate plugin 2.1
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="test.ProviderPerson"
table="ProviderPerson"
>
<id
name="idproviderPerson"
type="java.lang.String"
column="IdProviderPerson"
>
<generator class="uuid.hex"/>
</id>
<property
name="name"
type="java.lang.String"
column="name"
not-null="true"
length="18"
/>
<property
name="idnumber"
type="java.lang.String"
column="IdNumber"
not-null="true"
length="18"
/>
<!-- Associations -->
<!-- bi-directional one-to-many association to ProviderBill -->
<set
name="providerBills"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="IdProviderPerson"/>
</key>
<one-to-many
class="test.ProviderBill"
/>
</set>
</class>
<sql-query name="ProviderPersonByIdNumber">
<return alias="person" class="test.ProviderPerson"/>
<![CDATA[
select {person.*} from ProviderPerson {person} where IdNumber = :idnumber
]]>
</sql-query>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
See below
Full stack trace of any exception that occurs:
N/A
Name and version of the database you are using:
MS SQL Server 2000
The generated SQL (show_sql=true):
N/A
Debug level Hibernate log excerpt:
N/A
I'm using hibernate + session beans on bea weblogic 8.1 sp3. What I'm trying to do is letting the work of managing transactions to the application server, but I think that I have some configuration missing.
When I use the following code between sessionFactory.openSession() and session.close()
it doesn't save anything to the database. The implementation of dao.add it's just a plain call to the session.save().
Code:
String key = (String) dao.add(providerPerson);
But, if I use the above code with a hibernate transaction it works:
Code:
Transaction transaction = dao.getCurrentTransaction();
String key = (String) dao.add(providerPerson);
transaction.commit();
What do I need to configure in order to use the underlying app-container's transaction for my db commands?