-->
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: Insert Objcet work with 3.05 not work with 3.1
PostPosted: Fri Dec 16, 2005 4:05 am 
Regular
Regular

Joined: Wed Sep 22, 2004 8:27 am
Posts: 89
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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 16, 2005 4:09 am 
Regular
Regular

Joined: Wed Sep 22, 2004 8:27 am
Posts: 89
The problem is , after read hibernate log, no SQL insert was genereted after execute save command and commit command.

With Hibernate 3.05 all records have been stored, now no records are store.

Why?

thanks.


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.