Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2.1.8
Mapping documents:
Code:
<class
name="com.acme.AttributeType"
table="attribute_type"
proxy="com.acme.AttributeType"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
>
<cache usage="nonstrict-read-write" />
<id
name="id"
column="id"
type="java.lang.String"
unsaved-value="null"
>
<generator class="uuid.hex">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-AttributeType.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<map
name="names"
table="attribute_type_name"
lazy="false"
sort="unsorted"
inverse="false"
cascade="all"
>
<key
column="attribute_type_id"
>
</key>
<index
column="locale_id"
type="string"
/>
<element
column="translation"
type="string"
not-null="false"
unique="false"
/>
</map>
<map
name="descriptions"
table="attribute_type_description"
lazy="false"
sort="unsorted"
inverse="false"
cascade="all"
>
<key
column="attribute_type_id"
>
</key>
<index
column="locale_id"
type="string"
/>
<element
column="translation"
type="string"
not-null="false"
unique="false"
/>
</map>
<property
name="keyCode"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="key_code"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-AttributeType.xml
containing the additional properties and place it in your merge dir.
-->
</class>
Code between sessionFactory.openSession() and session.close():Code:
session.find("from AttributeType");
Full stack trace of any exception that occurs:Name and version of the database you are using: SQL Server 2000
The problem I am having is that despite the finder retrieving the list of AttributeTypes, and correct SQL is generated as I can see it in the SQL profiler, the returned AttributeTypes are the enhanced CGLIB proxies and not the initialized AttributeTypes.
Code:
AttributeType$$EnhancerByCGLIB$$
This is a pretty basic operation that I've done in the past many many times. However, on this occassion something (I'm sure that it is fundamental) is disallowing the entity from being correctly initialized.
If I iterate over the list and individually Hibernate.initialize or access a property the AttributeTypes are initialized. However, this shouldn't be the case, they should have been initialized immediatley upon return of the finder.
Please advise.
Roll