Hello,
version: Hibernate 3.1.3
We used Database Explorer to reverse engineer a table with no primary keys. D.E. has generated two classes MyClass and MyClassId and one mapping which is shown below:
Code:
?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="foo.MyClass" table="TABLE1" schema="USER1" lazy="false" >
<composite-id name="id" class="foo.MyClassId">
<key-property name="prop1" type="java.lang.String">
<column name="PROP1" length="4" />
</key-property>
<key-property name="prop2" type="java.lang.Long">
<column name="PROP2" precision="5" scale="0" />
</key-property>
<key-property name="prop3" type="java.lang.String">
<column name="PROP3" length="1" />
</key-property>
<key-property name="prop4" type="java.lang.String">
<column name="PROP4" length="8" />
</key-property>
<key-property name="prop5" type="java.lang.String">
<column name="PROP5" length="1" />
</key-property>
<key-property name="prop6" type="java.lang.String">
<column name="PROP6" length="1" />
</key-property>
<key-property name="prop7" type="timestamp">
<column name="PROP7" length="7" />
</key-property>
<key-property name="prop8" type="java.lang.String">
<column name="PROP8" length="3" />
</key-property>
<key-property name="prop9" type="java.lang.String">
<column name="PROP9" length="8" />
</key-property>
<key-property name="prop10" type="java.lang.String">
<column name="PROP10" length="16" />
</key-property>
<key-property name="prop11" type="java.lang.String">
<column name="PROP11" length="600" />
</key-property>
<key-property name="prop12" type="timestamp">
<column name="PROP12" length="7" />
</key-property>
<key-property name="prop13" type="timestamp">
<column name="PROP13" length="7" />
</key-property>
<key-property name="prop14" type="java.lang.String">
<column name="PROP14" length="8" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
When we do a query like this:
from MyClass h fetch all properties where h.id.prop1 = ? and h.id.prop2 = ? and h.id.prop3 = ? and h.id.prop4= ?
Hibernate finds matching rows but does not hydrate:
Code:
5437 [main] DEBUG org.hibernate.loader.Loader - processing result set
5437 [main] DEBUG org.hibernate.loader.Loader - result set row: 0
5437 [main] DEBUG org.hibernate.type.StringType - returning '06' as column: xxx
5437 [main] DEBUG org.hibernate.type.LongType - returning '31215' as column: xxx
5437 [main] DEBUG org.hibernate.type.StringType - returning '6' as column: xxx
5437 [main] DEBUG org.hibernate.type.StringType - returning 'ABCDE' as column: xxx
5453 [main] DEBUG org.hibernate.type.StringType - returning '0' as column: xxx
5453 [main] DEBUG org.hibernate.type.StringType - returning 'C' as column: xxx
5468 [main] DEBUG org.hibernate.type.TimestampType - returning '2006-07-17 11:30:18' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning 'V' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning 'XYZ' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning null as column: xxx
5468 [main] DEBUG org.hibernate.loader.Loader - result row: null
5468 [main] DEBUG org.hibernate.loader.Loader - result set row: 1
5468 [main] DEBUG org.hibernate.type.StringType - returning '06' as column: xxx
5468 [main] DEBUG org.hibernate.type.LongType - returning '31215' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning '6' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning 'FGHIJ' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning '0' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning 'O' as column: xxx
5468 [main] DEBUG org.hibernate.type.TimestampType - returning '2007-04-10 14:26:21' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning 'V' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning 'ORDON_01' as column: xxx
5468 [main] DEBUG org.hibernate.type.StringType - returning null as column: xxx
5468 [main] DEBUG org.hibernate.loader.Loader - result row: null
5468 [main] DEBUG org.hibernate.loader.Loader - done processing result set (2 rows)
5468 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
5468 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
5468 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
5484 [main] DEBUG org.hibernate.loader.Loader - total objects hydrated: 0
Any idea ?
Thanks.
Denis.