I am having the same problem with data not being persisted on save. I'm using Hibernate with Spring via HibernateTemplate.
JDK 1.4.2_06, latest ojdbc14.jar from Oracle, dabatabase is Oracle 8.1.7.2, hibernate version 2.1.6, 9.8.2004, spring 1.1.2
applicationContext.xml
Code:
<bean id="ppsSessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
...
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
<prop key="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</prop>
<prop key="hibernate.connection.url">jdbc:oracle:thin:@dbhost:1522:bisd</prop>
<prop key="hibernate.connection.username">foo</prop>
<prop key="hibernate.connection.password">bar</prop>
<prop key="hibernate.c3p0.min_size">5</prop>
<prop key="hibernate.c3p0.max_size">20</prop>
<prop key="hibernate.c3p0.timeout">1800</prop>
<prop key="hibernate.c3p0.max_statements">50</prop>
</props>
</property>
</bean>
<bean id="myTransactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory"><ref local="ppsSessionFactory"/></property>
</bean>
Application code:Code:
getHibernateTemplate().update(facility);
Debug level Hibernate log excerpt:Code:
DEBUG net.sf.hibernate.impl.SessionImpl - opened session
DEBUG net.sf.hibernate.impl.SessionImpl - updating [gov.ca.dfg.pps.domain.objects.Facility#128]
DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
DEBUG net.sf.hibernate.impl.SessionImpl - Updating entity: [gov.ca.dfg.pps.domain.objects.Facility#128]
DEBUG net.sf.hibernate.impl.SessionImpl - Collection found: [gov.ca.dfg.pps.domain.objects.Facility.facilityContactMechanisms#128], was: [gov.ca.dfg.pps.domain.objects.Facility.facilityContactMechanisms#128]
DEBUG net.sf.hibernate.impl.SessionImpl - Collection found: [gov.ca.dfg.pps.domain.objects.Facility.facilities#128], was: [gov.ca.dfg.pps.domain.objects.Facility.facilities#128]
DEBUG net.sf.hibernate.impl.SessionImpl - Collection found: [gov.ca.dfg.pps.domain.objects.Facility.partyFacilities#128], was: [gov.ca.dfg.pps.domain.objects.Facility.partyFacilities#128]
DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 1 updates, 0 deletions to 1 objects
DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 3 collections
DEBUG net.sf.hibernate.impl.Printer - listing entities:
DEBUG net.sf.hibernate.impl.Printer - gov.ca.dfg.pps.domain.objects.Facility{facilityType=FacilityType#2, facilityName=Fish and Game Headquarters -TEST, facility=null, facilitySeq=128, creationDate=2002-03-22 11:06:01, partyFacilities=[PartyFacility#PartyFacilityPK{partySeq=81515, partyFacilitySeq=499, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=91779, partyFacilitySeq=446, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81513, partyFacilitySeq=369, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=91779, partyFacilitySeq=448, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81516, partyFacilitySeq=329, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81517, partyFacilitySeq=281, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81507, partyFacilitySeq=370, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81512, partyFacilitySeq=365, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81508, partyFacilitySeq=373, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81516, partyFacilitySeq=328, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81516, partyFacilitySeq=368, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81518, partyFacilitySeq=366, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81515, partyFacilitySeq=374, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81517, partyFacilitySeq=128, facFacilitySeq=128}, PartyFacility#PartyFacilityPK{partySeq=81514, partyFacilitySeq=367, facFacilitySeq=128}], lastUpdatedByUserId=null, lastUpdatedDate=null, createdByUserId=BIS_WEB, squareFootage=null, description=null, facilities=uninitialized, facilityContactMechanisms=[FacilityContactMechanism#311, FacilityContactMechanism#309, FacilityContactMechanism#310]}
DEBUG net.sf.hibernate.impl.SessionImpl - executing flush
DEBUG net.sf.hibernate.persister.EntityPersister - Updating entity: [gov.ca.dfg.pps.domain.objects.Facility#128]
DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
DEBUG net.sf.hibernate.SQL - update FACILITY set CREATED_BY_USER_ID=?, DESCRIPTION=?, LAST_UPDATED_BY_USER_ID=?, LAST_UPDATED_DATE=?, FACILITY_NAME=?, SQUARE_FOOTAGE=?, CREATION_DATE=?, FAC_FACILITY_SEQ=?, FACILITY_TYPE_SEQ=? where FACILITY_SEQ=?
Hibernate: update FACILITY set CREATED_BY_USER_ID=?, DESCRIPTION=?, LAST_UPDATED_BY_USER_ID=?, LAST_UPDATED_DATE=?, FACILITY_NAME=?, SQUARE_FOOTAGE=?, CREATION_DATE=?, FAC_FACILITY_SEQ=?, FACILITY_TYPE_SEQ=? where FACILITY_SEQ=?
DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
DEBUG net.sf.hibernate.persister.EntityPersister - Dehydrating entity: [gov.ca.dfg.pps.domain.objects.Facility#128]
DEBUG net.sf.hibernate.type.StringType - binding 'BIS_WEB' to parameter: 1
DEBUG net.sf.hibernate.type.StringType - binding null to parameter: 2
DEBUG net.sf.hibernate.type.StringType - binding null to parameter: 3
DEBUG net.sf.hibernate.type.TimestampType - binding null to parameter: 4
DEBUG net.sf.hibernate.type.StringType - binding 'Headquarters' to parameter: 5
DEBUG net.sf.hibernate.type.BigDecimalType - binding null to parameter: 6
DEBUG net.sf.hibernate.type.TimestampType - binding '2002-03-22 11:06:01' to parameter: 7
DEBUG net.sf.hibernate.type.BigDecimalType - binding null to parameter: 8
DEBUG net.sf.hibernate.engine.Cascades - id unsaved-value strategy NULL
DEBUG net.sf.hibernate.type.BigDecimalType - binding '2' to parameter: 9
DEBUG net.sf.hibernate.type.BigDecimalType - binding '128' to parameter: 10
DEBUG net.sf.hibernate.impl.BatcherImpl - Adding to batch
DEBUG net.sf.hibernate.impl.BatcherImpl - Executing batch size: 1
DEBUG net.sf.hibernate.impl.BatcherImpl - success of batch update unknown: 0
DEBUG net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
DEBUG net.sf.hibernate.impl.BatcherImpl - closing statement
DEBUG net.sf.hibernate.impl.SessionImpl - post flush
DEBUG net.sf.hibernate.impl.SessionImpl - closing session
DEBUG net.sf.hibernate.impl.SessionImpl - disconnecting session
DEBUG net.sf.hibernate.impl.SessionImpl - transaction completion
Before this, I was using an older Oracle JDBC driver that was giving errors as described here
http://forum.hibernate.org/viewtopic.php?t=934050. I tried setting the hibernate.c3p0.max_statements=0 but that did not help. I also tried using the JDBC driver from Oracle compiled with -g which hung completely when exectuting the batch update.
Here
http://forum.hibernate.org/viewtopic.php?t=932154 is another instance of the same issue with no resolution there either.