-->
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: weird problem with resultset
PostPosted: Mon Aug 02, 2004 3:51 pm 
Newbie

Joined: Mon Feb 02, 2004 4:18 pm
Posts: 16
I've written an application that record details about machines, each each machine having many fields composed of complex types such as MachineType etc. I've included the mapping file to see what the class would contain.

I'm having a problem when I try to query the database for all machines in the DB, I'm getting a SerializationException caused by an EOFException (see stack trace below). Does this ring a bell with any users? Am I breaking a mapping rule that manifests itself this way? Any help would be greatly appreciated because everything looks correct on the surface and all of the other mappings work correctly. I'm thinking that I have perhaps put in a circular reference which never completes so it decides to bomb out instead :(

This is happening with Hibernate 2.1.4, JDK 1.4.2, MySQL 4.0

Mapping document

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping package="xxxxxxx">
<class name="Machine" table="machine">
<id
name="id"
type="java.lang.Integer"
column="id"
>
<generator class="native"/>
</id>

<property
name="dateManufactured"
column="date_of_manufactured"
type="java.sql.Timestamp"
not-null="false"
length="14"
/>
<property
name="manufarturerName"
column="manufarturer_name"
type="java.lang.String"
not-null="false"
length="40"
/>
<property
name="maintFrequencyWeeks"
column="maint_frequency_weeks"
type="java.lang.Integer"
not-null="true"
length="4"
/>
<property
name="hardwareNotes"
column="hardware_notes"
type="java.lang.String"
not-null="false"
/>
<property
name="maintStartDate"
column="maint_start_date"
type="java.sql.Timestamp"
not-null="false"
length="14"
/>
<property
name="dateLastService"
column="date_last_service"
type="java.sql.Timestamp"
not-null="false"
length="14"
/>
<property
name="softwareVersion"
column="software_version"
type="java.lang.String"
not-null="false"
length="20"
/>
<property
name="keyNumber1"
column="key_number1"
type="java.lang.String"
not-null="false"
length="20"
/>
<property
name="keyNumber3"
column="key_number3"
type="java.lang.String"
not-null="false"
length="20"
/>
<property
name="warrantyExpiryDate"
column="warranty_expiry_date"
type="java.sql.Timestamp"
not-null="false"
length="14"
/>
<property
name="contractExpiryDate"
column="contract_expiry_date"
type="java.sql.Timestamp"
not-null="false"
length="14"
/>
<property
name="location"
column="location"
type="java.lang.String"
not-null="false"
length="60"
/>
<property
name="manufSerialNumber"
column="manuf_serial_number"
type="java.lang.String"
not-null="false"
length="25"
/>
<property
name="dateLastTicketed"
column="date_last_ticketed"
type="java.sql.Timestamp"
not-null="false"
length="14"
/>
<property
name="region"
column="region_id"
type="ie.uts.Region"
not-null="true"
length="10"
/>

<property
name="numbered"
column="numbered"
type="java.lang.Integer"
not-null="false"
length="1"
/>
<property
name="keyNumber2"
column="key_number2"
type="java.lang.String"
not-null="false"
length="20"
/>
<property
name="description"
column="description"
type="java.lang.String"
not-null="false"
length="40"
/>
<property
name="model"
column="model"
type="java.lang.String"
not-null="false"
length="40"
/>
<property
name="ourMachineNumber"
column="our_machine_number"
type="java.lang.String"
not-null="false"
length="20"
/>
<property
name="dateInstalled"
column="date_installed"
type="java.sql.Timestamp"
not-null="false"
length="14"
/>

<many-to-one
name="machineType"
class="MachineType"
not-null="true"
>
<column name="machine_type_id" />
</many-to-one>

<many-to-one
name="tariffSet"
class="Tariff"
not-null="true"
>
<column name="tariff_set" />
</many-to-one>

<many-to-one
name="customer"
class="Customer"
not-null="true"
>
<column name="customer" />
</many-to-one>

<many-to-one
name="contractType"
class="ContractType"
not-null="true"
>
<column name="contract_type" />
</many-to-one>
</class>

</hibernate-mapping>

Stack trace
02-Aug-2004 20:42:19 net.sf.hibernate.impl.SessionImpl finalize
WARNING: unclosed connection
net.sf.hibernate.type.SerializationException: could not deserialize
at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:197)
at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:220)
at net.sf.hibernate.type.SerializableType.fromBytes(SerializableType.java:73)
at net.sf.hibernate.type.SerializableType.get(SerializableType.java:38)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:66)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:611)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:552)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:511)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:426)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:209)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
at net.sf.hibernate.loader.Loader.list(Loader.java:946)
at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:121)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3609)
at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
at common.dao.HibernateDAO.findByCriteria(HibernateDAO.java:885)
at common.delegate.GenericDelegate.findByCriteria(GenericDelegate.java:49)
at common.taglib.ListTag.doEndTag(ListTag.java:50)
at org.apache.jsp.login.view_005fmachines_jsp._jspx_meth_db_list_0(view_005fmachines_jsp.java:156)
at org.apache.jsp.login.view_005fmachines_jsp._jspService(view_005fmachines_jsp.java:65)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2165)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2631)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:734)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:189)
... 52 more


Top
 Profile  
 
 Post subject: answer the questions
PostPosted: Mon Aug 02, 2004 4:08 pm 
Newbie

Joined: Mon Feb 02, 2004 4:18 pm
Posts: 16
I'm using hibernatesynch to generate the mapping documents and it added one of the fields (region) as a property instead of a many-to-one, remapped and it worked fine.


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.