Reputation: 9296
I'm trying to use hibernate to fill my jsf selectonemenu
in ApplicationBean
(in Liferay). The problem is that I got Initial SessionFactory
creation failed problem. Before putting my functions in the applicationbean I was setting them in sessionbean and I got no error.
For now the full error
Initial SessionFactory creation failed.
java.lang.ClassCastException: org.hibernate.type.StringType cannot be cast to org.hibernate.type.VersionType
Upvotes: 4
Views: 6089
Reputation: 570355
You have very likely a VARCHAR
column called VERSION
somewhere and Hibernate's reverse engineering tool generates it as:
<version name="version" type="string">
<column name="VERSION" length="20" />
</version>
instead of:
<property name="version" type="string">
<column name="VERSION" length="20" />
</property>
The former is wrong. First, I think that this is not what you want. Second, a string is not allowed for a version field as mentioned in the chapter 5.1.9. Version (optional):
Version numbers can be of Hibernate type
long
,integer
,short
,timestamp
orcalendar
.
This problem has been somehow reported in HHH-3002 (actually, it should be assigned to Hibernate Tools, not Hibernate Core) and I see two ways to solve it. Either
Upvotes: 8
Reputation: 72870
The property on one of your domain classes that you've mapped as the class's version is of type string. This is not a valid type for a version. What to change it to will depend on how you are implementing versioning in your underlying database.
Upvotes: 1