-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate doesn' persist my object
PostPosted: Thu Sep 21, 2006 9:12 am 
Newbie

Joined: Thu Sep 21, 2006 8:09 am
Posts: 1
Hi,

I am encountering a problem with Hibernate.
In a method I need to save a first object then I call a second method and try to save a second object. I encounter a problem (not an exception) when saving the object.

I am using
Hibernate version: 3.2.0CR2
Spring-hibernate Version : 2.0 CR1
Spring : 1.2.8

My Code :
Code:
@transactional
public void GeneralMethod() {
Method1();

}

public void Method1(){
generate Object1()
getMyDao().update(Object1);

method2();

}

public void method2() {

lBroadcast.setCsaCategory(lCsaCat);
lBroadcast.setDuration(lDuration);
      
getBroadcastEventDao().update(lBroadcast);
}


The getBroadcastEventDao() and getMyDao calls this Dao Method :
Code:
public class GenericDAOHibernateImpl<T> extends HibernateDaoSupport implements IGenericDAO<T>
{

    private static Log sLog = LogFactory.getLog(GenericDAOHibernateImpl.class);

    /**
     * save a single object
     */
    public void save(T pObject)
    {
        // Vérification.
        if (pObject == null)
        {
            throw new IllegalArgumentException("pObject est null");
        }

        // Met à jour l'objet.
        getSession(true).persist(pObject);
    }

    /**
     * update a single object
     */
    public void update(T pObject)
    {
        // Vérification.
        if (pObject == null)
        {
            throw new IllegalArgumentException("pObject est null");
        }

        // Met à jour l'objet.
        getSession(true).merge(pObject);
    }


I try with My save or update methods but I have the same problem no saving of my objects.


If I don't call my method2, Object1 is persisted in my DB.


If somebody has an idea it may be helpful

thanks

thomas

Full stack trace of any exception that occurs:
13:59:40,656 - DEBUG - org.springframework.jdbc.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource [org.apache.commons.dbcp.BasicDataSource@691177]
13:59:40,656 - DEBUG - org.springframework.jdbc.support.SQLErrorCodesFactory - Database product name found in cache for DataSource [org.apache.commons.dbcp.BasicDataSource@691177]: name is 'MySQL'
13:59:40,656 - DEBUG - org.springframework.jdbc.support.SQLErrorCodesFactory - SQL error codes for 'MySQL' found
13:59:40,656 - DEBUG - org.springframework.transaction.support.TransactionSynchronizationManager - Retrieved value [org.springframework.orm.hibernate3.SessionHolder@143bf3d] for key [org.hibernate.impl.SessionFactoryImpl@c06258] bound to thread [main]
13:59:40,656 - DEBUG - org.hibernate.engine.IdentifierValue - id unsaved-value: 0
13:59:40,656 - DEBUG - org.hibernate.event.def.AbstractSaveEventListener - transient instance of: fr.mos.eismo.business.model.epg.BroadcastEvent
13:59:40,656 - DEBUG - org.hibernate.event.def.DefaultPersistEventListener - saving transient instance
13:59:40,656 - DEBUG - org.hibernate.event.def.AbstractSaveEventListener - saving [fr.mos.eismo.business.model.epg.BroadcastEvent#<null>]
13:59:40,656 - DEBUG - org.hibernate.event.def.AbstractSaveEventListener - executing insertions
13:59:40,671 - DEBUG - org.hibernate.event.def.AbstractSaveEventListener - executing identity-insert immediately
13:59:40,671 - DEBUG - org.hibernate.persister.entity.AbstractEntityPersister - Inserting entity: fr.mos.eismo.business.model.epg.BroadcastEvent (native id)
13:59:40,671 - DEBUG - org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:59:40,671 - DEBUG - org.hibernate.SQL - insert into BROADCAST_EVENT (CSA_CATEGORY, START_DATETIME, DURATION, PROGRAM_ID_FK, PIC_FMT, VISU_FMT, CHANNEL_ID_FK) values (?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into BROADCAST_EVENT (CSA_CATEGORY, START_DATETIME, DURATION, PROGRAM_ID_FK, PIC_FMT, VISU_FMT, CHANNEL_ID_FK) values (?, ?, ?, ?, ?, ?, ?)
13:59:40,671 - DEBUG - org.hibernate.jdbc.AbstractBatcher - preparing statement
13:59:40,671 - DEBUG - org.hibernate.persister.entity.AbstractEntityPersister - Dehydrating entity: [fr.mos.eismo.business.model.epg.BroadcastEvent#<null>]
13:59:40,671 - DEBUG - org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:59:40,671 - DEBUG - org.hibernate.jdbc.AbstractBatcher - closing statement
13:59:40,671 - DEBUG - org.springframework.transaction.interceptor.RuleBasedTransactionAttribute - Applying rules to determine whether transaction should rollback on java.lang.NullPointerException
13:59:40,671 - DEBUG - org.springframework.transaction.interceptor.RuleBasedTransactionAttribute - Winning rollback rule is: null
13:59:40,671 - DEBUG - org.springframework.transaction.interceptor.RuleBasedTransactionAttribute - No relevant rollback rule found: applying superclass default
13:59:40,671 - DEBUG - org.springframework.transaction.interceptor.TransactionInterceptor - Invoking rollback for transaction on fr.mos.eismo.service.iMediaPress.JibxObjectToDB.write due to throwable [java.lang.NullPointerException]
13:59:40,671 - DEBUG - org.springframework.orm.hibernate3.HibernateTransactionManager - Triggering beforeCompletion synchronization
13:59:40,671 - DEBUG - org.springframework.orm.hibernate3.HibernateTransactionManager - Initiating transaction rollback
13:59:40,671 - DEBUG - org.springframework.orm.hibernate3.HibernateTransactionManager - Rolling back Hibernate transaction on Session [org.hibernate.impl.SessionImpl@1e6e305]
13:59:40,671 - DEBUG - org.hibernate.transaction.JDBCTransaction - rollback
13:59:40,750 - DEBUG - org.hibernate.transaction.JDBCTransaction - re-enabling autocommit
13:59:40,781 - DEBUG - org.hibernate.transaction.JDBCTransaction - rolled back JDBC Connection
13:59:40,781 - DEBUG - org.hibernate.jdbc.JDBCContext - after transaction completion
13:59:40,781 - DEBUG - org.hibernate.jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
13:59:40,781 - DEBUG - org.hibernate.impl.SessionImpl - after transaction completion
13:59:40,781 - DEBUG - org.springframework.orm.hibernate3.HibernateTransactionManager - Triggering afterCompletion synchronization
13:59:40,781 - DEBUG - org.springframework.transaction.support.TransactionSynchronizationManager - Clearing transaction synchronization
13:59:40,781 - DEBUG - org.springframework.transaction.support.TransactionSynchronizationManager - Removed value [org.springframework.orm.hibernate3.SessionHolder@143bf3d] for key [org.hibernate.impl.SessionFactoryImpl@c06258] from thread [main]
13:59:40,781 - DEBUG - org.springframework.transaction.support.TransactionSynchronizationManager - Removed value [org.springframework.jdbc.datasource.ConnectionHolder@12fb0af] for key [org.apache.commons.dbcp.BasicDataSource@691177] from thread [main]
13:59:40,781 - DEBUG - org.springframework.orm.hibernate3.HibernateTransactionManager - Closing Hibernate Session [org.hibernate.impl.SessionImpl@1e6e305] after transaction
13:59:40,781 - DEBUG - org.springframework.orm.hibernate3.SessionFactoryUtils - Closing Hibernate Session
13:59:40,781 - DEBUG - org.hibernate.impl.SessionImpl - closing session
13:59:40,781 - DEBUG - org.hibernate.jdbc.ConnectionManager - performing cleanup
13:59:40,781 - DEBUG - org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
13:59:40,796 - DEBUG - org.hibernate.jdbc.JDBCContext - after transaction completion
13:59:40,796 - DEBUG - org.hibernate.jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
13:59:40,796 - DEBUG - org.hibernate.impl.SessionImpl - after transaction completion


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.