I'm using hibernatesynch to create the mapping files for an application, here is the file produced,
<?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="xxxxxxxx">
<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>
When I try to query using a criteria, but pass in no criteria (in which case it should find all machines), I get net.sf.hibernate.type.SerializationException and no results are returned.
Here is the stack trace
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:950)
at net.sf.hibernate.loader.Loader.list(Loader.java:941)
at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3571)
at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:223)
at common.dao.HibernateDAO.findByCriteria(HibernateDAO.java:885)
at common.delegate.GenericDelegate.findByCriteria(GenericDelegate.java:49)
at common.delegate.GenericDelegate.findByCriteria(GenericDelegate.java:41)
at org.apache.jsp.test.test_005fmachines_jsp._jspService(test_005fmachines_jsp.java:58)
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)
... 51 more
The same code works for all othe classes in the application like Customer, ContractType etc. I'm using the hibernate 2.1.4 with JDK 1.4.2_04-b05 on Windows XP.
|