Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.1
Mapping documents:
<hibernate-mapping default-lazy="false">
Code:
<class name="com.coginfo.kf.bean.Categoria" table="KFT_CATEGORIA" select-before-update="true">
<id name="codint" type="long" unsaved-value="0">
<generator class="sequence">
<param name="sequence">KF_SEQ_CATEGORIA</param>
</generator>
</id>
<property name="cafdsc" type="string">
<column name="cafdsc" length="1000" sql-type="string" not-null="true"/>
</property>
<set name="categoriaAclSviluppatori" where="stsacl = '2'" lazy="true" cascade="none">
<key column="codintctg"/>
<one-to-many class="com.coginfo.kf.bean.CategoriaAcl"/>
</set>
<set name="categoriaAclCollaudatori" where="stsacl = '3'" lazy="true" cascade="none">
<key column="codintctg"/>
<one-to-many class="com.coginfo.kf.bean.CategoriaAcl"/>
</set>
<set name="categoriaAclAmministratori" where="stsacl = '1'" lazy="true" cascade="none">
<key column="codintctg"/>
<one-to-many class="com.coginfo.kf.bean.CategoriaAcl"/>
</set>
<set name="categoriaRuoli" lazy="true" cascade="none">
<key column="codintctg"/>
<one-to-many class="com.coginfo.kf.bean.CategoriaRuolo"/>
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close(): Code:
beginTransaction();
insert(bean);
commitTransaction();
public void insert(Object data) throws InsertException {
try {
session.save(data);
}
catch (NonUniqueObjectException nuoe){
throw new InsertException();
}
catch (HibernateException ex) {
throw ue;
}
}
public void commitTransaction() throws DAOServiceException {
Transaction tx = (Transaction) threadTransaction.get();
try {
if ( tx != null && !tx.wasCommitted() && !tx.wasRolledBack() ) {
tx.commit();
}
threadTransaction.set(null);
}
catch (HibernateException ex) {
rollbackTransaction();
throw dse;
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}
Full stack trace of any exception that occurs:
No exception
Name and version of the database you are using:
Oracle 9
The generated SQL (show_sql=true):
No SQL insert genereted