Hi,
I'm running 3.2.6.ga and was mapping in a legacy MySQL DB (MySQL 5.0.37-community-nt) using hibernatetool. The table had an attribute called "version" on it. I noticed when I tried to run it I got the following exception:
Code:
Caused by: java.lang.ClassCastException: org.hibernate.type.StringType
at org.hibernate.tuple.PropertyFactory.buildVersionProperty(PropertyFactory.java:84)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:170)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
I looked in my mapping file and noticed it had produced:
Code:
<version name="version" type="string">
<column name="version" length="32" />
</version>
when it should have produced:
Code:
<property name="version" type="string">
<column name="version" length="32" not-null="true"/>
</property>
So, I changed it to an attribute and ran my code and it seems to work just fine. Is this a configuration issue on my end or a bug?
Thanks,
Ben