Hi all,
I don't understand why hibernate try to update once it load the object (look at the SQL trace!)? Here's my java code :
Query query = arg0.getNamedQuery("gss_get_appel_sommaire");
query.setLong("p_pta_id", ptaId.longValue());
query.setLong("p_res_id", repartiteurResId.longValue());
return query.list();
My function return objects which are mapped to a view.
Hibernate version: 3
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.gazmet.mike.model.valueObject">
<class name="AppelSommaireVO" table="GSVAPP_APPEL">
<id name="appelId" column="APP_ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">GSQAPP_ID</param>
</generator>
</id>
<property name="dateAnnulation" column="APP_DT_ANNULE" type="java.lang.String" />
<property name="dateAppelRecu" column="APP_DT_APPEL_RECU" type="java.lang.String" />
<property name="dateAvisEnvoye" column="APP_DT_AVIS_ENVOYE" type="java.lang.String" />
<property name="datePriseEnCharge" column="APP_DT_PRISE_EN_CHARGE" type="java.lang.String" />
....
</class>
<!-- The stored procedure call to retrieve the list of calls -->
<sql-query name="gss_get_appel_sommaire" callable="true">
<return class="AppelSommaireVO" />
{ ? = call gss_get_appel_sommaire_test(:p_pta_id, :p_res_id) }
</sql-query>
</hibernate-mapping>
Full stack trace of any exception that occurs:
java.lang.ClassCastException
at org.hibernate.type.LongType.set(LongType.java:40)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:39)
at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1617)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1963)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1909)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2149)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:249)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:313)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:288)
at com.gazmet.mike.model.dao.AppelDaoHibernateImpl.lireListeAppel(AppelDaoHibernateImpl.java:198)
at test.AppelDaoTest.testLireListeAppel(AppelDaoTest.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
DEBUG main com.gazmet.mike.model.dao.AppelDaoHibernateImpl - lireListeAppel: gss_get_appel_sommaire(1, 486)
DEBUG main org.hibernate.SQL - { ? = call gss_get_appel_sommaire_test(?, ?) }
DEBUG main org.hibernate.SQL - update GSVAPP_APPEL set APP_DT_ANNULE=?, APP_DT_APPEL_RECU=?, APP_DT_AVIS_ENVOYE=?, APP_DT_PRISE_EN_CHARGE=?, APP_RES_ID_PRISE_EN_CHARGE=?, APP_PTA_ID_ASSIGNE=?, APP_CD_TYPE_APPEL=?, APP_CD_STATUT=?, APP_CD_ETAT=?, APP_NO_VERROU=?, APP_DT_MAJ=?, APP_USERID_MAJ=?, APP_RES_ID_AVIS_ENVOYE_PAR=?, AVIS_ENVOYE_PAR_NOM=?, AVIS_ENVOYE_PAR_PRENOM=?, APP_RES_ID_APPELANT=?, APPELANT_NOM=?, APPELANT_PRENOM=?, APPELANT_NO_CONTACT_DIRECT=?, APPELANT_PTA_CODE=?, NBAVISSUCCES=?, NBAVISECHEC=?, NBAPPELSUCCES=?, NBAPPELECHEC=? where APP_ID=?
|