[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3002) database field name 'version' causes ClassCastException while building session factory
Sergio Manero (JIRA)
noreply at atlassian.com
Tue Jan 20 04:05:39 EST 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32161#action_32161 ]
Sergio Manero commented on HHH-3002:
------------------------------------
Using Hibernate-tools to Oracle10gi
Environment: JDK1.6/JBossAS5/Hibernate3
Resume: Annotations generated causes the same problem. It's necessary to manually fix it.
java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType
In class generated @Version affects field named "private String Version"
> database field name 'version' causes ClassCastException while building session factory
> --------------------------------------------------------------------------------------
>
> Key: HHH-3002
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3002
> Project: Hibernate Core
> 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