[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3002) database field name 'version' causes ClassCastException while building session factory
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Fri Dec 7 17:08:56 EST 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29098 ]
Emmanuel Bernard commented on HHH-3002:
---------------------------------------
if Hibernate try to use a VersionType it's because in your mapping there is a <version /> element. Othewise it does not guess.
Now Hibernate *tools* will try to guess when reverse engineering, but this a different... tool, not hibernate core.
> 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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list