-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: StringType cannot be cast to VersionType
PostPosted: Fri Oct 05, 2007 1:14 pm 
Newbie

Joined: Mon Sep 17, 2007 5:31 pm
Posts: 8
Hello,

When I make the following call:

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();

I get the following exception:

Initial SessionFactory creation failed.java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType
Exception in thread "main" java.lang.ExceptionInInitializerError
at util.HibernateUtil.<clinit>(HibernateUtil.java:23)
at Main.main(Main.java:12)
Caused by: java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType
at org.hibernate.tuple.PropertyFactory.buildVersionProperty(PropertyFactory.java:84)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:168)
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:1294)
at util.HibernateUtil.<clinit>(HibernateUtil.java:17)

Anyone have any ideas why this is happening and how I can fix it?

I am new to Hibernate, and I am just trying to get a feel for it. I used the Hibernate Tools for Eclipse to generate my POJO's from a small simple database. However I cannot get base the first step of getting a SessionFactory.

Also, being new, I am finding Hibernate difficult to get a handle on and working. I am used to just using JDBC and SQL. I never had to mess with XML or what not. I am willing to go through the pain of learning because it supposed to make my life easier in the long run, however the pain of learning is getting pretty high.

Any help is appreciated, Thanks...

-Creepy


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 06, 2007 6:47 pm 
Regular
Regular

Joined: Sun Sep 30, 2007 7:51 pm
Posts: 93
Looks like you are trying to map some string to a version type column. Maybe it's wrong configuration mapping file, or wrong class definition.

Regards,
Pavol


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 07, 2007 5:29 am 
Newbie

Joined: Mon Sep 17, 2007 5:31 pm
Posts: 8
Yeah I can read the exception too, however, as I stated, this was all autogenerated by the Hibernate Eclipse Tools plugin. Since (1) it is autogenerated code or XML and you should never modify autogenerated code, and (2) it doesn't say what mapping, or table/column is having the problem, so I cannot even verify where the problem is in the autogenerated code or XML to begin with, so cannot provide much more info that I provided in the orignal post.

I haven't created anything by hand except for the class with the main method and it cannot get past the first time.

So, either the autogeneration tool doesn't work or has bugs, or something else is wrong.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 07, 2007 9:38 am 
Regular
Regular

Joined: Sun Sep 30, 2007 7:51 pm
Posts: 93
Ah sorry, I have no experience with this autogeneration tools.

Regards,
Pavol


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.