]
Emmanuel Bernard resolved HHH-3002.
-----------------------------------
Resolution: Rejected
A version field has to be numeric
database field name 'version' causes ClassCastException while
building session factory
--------------------------------------------------------------------------------------
Key: HHH-3002
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3002
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5, Java 1.6.0_03, MySQL 5.0.41
Reporter: Patrick Burke
Attachments: out.hib4
When a database table contains a field named 'version', like his one:
DROP TABLE IF EXISTS `tester`.`software_package`;
CREATE TABLE `tester`.`software_package` (
`software_id` int(11) NOT NULL auto_increment,
`version` varchar(100) default NULL,
`name` varchar(100) default NULL,
`root_file_id` int(11) default NULL,
PRIMARY KEY (`software_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
The following error is thrown:
[java] Initial SessionFactory creation failed.java.lang.ClassCastException:
org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType
[java] Exception in thread "main" java.lang.ExceptionInInitializerError
[java] at util.HibernateUtil.<clinit>(Unknown Source)
[java] at events.EventManager.listNodes(Unknown Source)
[java] at events.EventManager.main(Unknown Source)
[java] Caused by: java.lang.ClassCastException: org.hibernate.type.StringType cannot
be cast to org.hibernate.type.VersionType
[java] at
org.hibernate.tuple.PropertyFactory.buildVersionProperty(PropertyFactory.java:84)
[java] at
org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:168)
[java] at
org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
[java] at
org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
[java] at
org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
[java] at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
[java] at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
[java] ... 3 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: