Hi,
I added a unique constraint over two non-key columns
and I am getting a nasty error while retrieving from the DB (insert worked ok). I really don't know where to start. I've searched the forums but could not find anything similar.
Once I remove the unique constraint, I can read from the DB.
thank you,
MartÃn
3.0:
Mapping documents:
Code:
<class
name="com.myco.dataaccess.accounting.finesfees.FeeGroup"
table="FEE_GROUP"
proxy="com.myco.dataaccess.accounting.finesfees.FeeGroup"
dynamic-update="true"
dynamic-insert="true"
>
<id name="ID"
column="ID"
type="java.lang.Long"
>
<generator class="identity">
</generator>
</id>
. . . Code:
<many-to-one
name="schedule"
class="com.myco.dataaccess.accounting.finesfees.Schedule"
cascade="none"
outer-join="auto"
update="true" insert="true"
column="SCHEDULE"
not-null="true"
/>
<property
name="abbreviation"
type="string"
update="true" insert="true"
column="ABBREV" length="25"
not-null="true"
/>
. . .
<!-- this is the unique index --> Code:
<properties name="indiceunico" unique="true" update="false" insert="false" />>
<property name="schedule" column="SCHEDULE" update="false" insert="false" />
<property name="abbreviation" column="ABBREV" update="false" insert="false"/>
</properties>
Code between sessionFactory.openSession() and session.close():list = ThreadSession.getSession()
.createCriteria(targetClass)
.add(Expression.eq(containerName, dao)) .list();
Full stack trace of any exception that occurs:DEBUG [http-8080-Processor24] (Loader.java:384) - processing result set
DEBUG [http-8080-Processor24] (Loader.java:389) - result set row: 0
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning '8' as column: ID0_
DEBUG [http-8080-Processor24] (Loader.java:791) - result row: EntityKey[com.myco.dataaccess.accounting.finesfees.FeeGroup#8]
DEBUG [http-8080-Processor24] (Loader.java:941) - Initializing object from ResultSet: [com.myco.dataaccess.accounting.finesfees.FeeGroup#8]
DEBUG [http-8080-Processor24] (BasicEntityPersister.java:1641) - Hydrating entity: [com.myco.dataaccess.accounting.finesfees.FeeGroup#8]
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning '2' as column: SCHEDULE24_0_
DEBUG [http-8080-Processor24] (NullableType.java:80) - returning null as column: DESCRIPT3_24_0_
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning 'DWI' as column: ABBREV24_0_
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning 'DWI' as column: NAME24_0_
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning 'false' as column: INACTIVE24_0_
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning '2005-06-22 08:59:43' as column: CREATED7_24_0_
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning '2' as column: CREATED8_24_0_
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning '2005-06-22 08:59:43' as column: CHANGED9_24_0_
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning '2' as column: CHANGED10_24_0_
DEBUG [http-8080-Processor24] (NullableType.java:86) - returning '0' as column: JSI11_24_0_
DEBUG [http-8080-Processor24] (SerializationHelper.java:198) - Starting deserialization of object
DEBUG [http-8080-Processor24] (AbstractBatcher.java:300) - about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG [http-8080-Processor24] (AbstractBatcher.java:285) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG [http-8080-Processor24] (AbstractBatcher.java:403) - closing statement
ERROR [http-8080-Processor24] (ListBO.java:631) -
org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:211) at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:234)
at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:78)
at org.hibernate.type.SerializableType.get(SerializableType.java:39)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:80)
at org.hibernate.type.ComponentType.hydrate(ComponentType.java:422)
at org.hibernate.persister.entity.BasicEntityPersister.hydrate(BasicEntityPersister.java:1680)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:954)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:905)
at org.hibernate.loader.Loader.getRow(Loader.java:818)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:297)
at org.hibernate.loader.Loader.doQuery(Loader.java:391)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:210)
at org.hibernate.loader.Loader.doList(Loader.java:1557)
at org.hibernate.loader.Loader.list(Loader.java:1540)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:113)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1254)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:299)
at com.myco.business.ListBO.loadDaoByLink(ListBO.java:629)
at com.myco.api.accounting.finesfees.FeeGroupGetAll.executeDataBase(FeeGroupGetAll.java:64)
at com.myco.api.BeanApiSession.execute(BeanApiSession.java:145)
at com.myco.web.action.JsiBeanAction.processRequest(JsiBeanAction.java:259)
at com.myco.web.action.JsiBeanAction.executeAction(JsiBeanAction.java:211)
at com.myco.web.action.BaseAction.execute(BaseAction.java:65)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at com.myco.web.util.JsiRequestProcessor.processActionPerform(JsiRequestProcessor.java:222)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at org.hibernate.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:246)
at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:203)
... 47 more
DEBUG [http-8080-Processor24] (SessionImpl.java:254) - closing session
Name and version of the database you are using:db2
The generated SQL (show_sql=true):Code:
Hibernate: select this_.ID as ID0_, this_.SCHEDULE as SCHEDULE24_0_, this_.DESCRIPTION as DESCRIPT3_24_0_, this_.ABBREV as ABBREV24_0_, this_.NAME as NAME24_0_, this_.INACTIVE as INACTIVE24_0_, this_.CREATED_DATE as CREATED7_24_0_, this_.CREATED_BY as CREATED8_24_0_, this_.CHANGED_DATE as CHANGED9_24_0_, this_.CHANGED_BY as CHANGED10_24_0_, this_.JSI_KEY as JSI11_24_0_ from FEE_GROUP this_ where this_.SCHEDULE=?
DEBUG [http-8080-Processor24] (AbstractBatcher.java:365) - preparing statement
DEBUG [http-8080-Processor24] (NullableType.java:59) - binding '2' to parameter: 1
DEBUG [http-8080-Processor24] (AbstractBatcher.java:293) - about to open ResultSet (open ResultSets: 0, globally: 0)
Debug level Hibernate log excerpt:full logging[/code]