-->
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.  [ 1 post ] 
Author Message
 Post subject: VERSION field name is not valid hibernate
PostPosted: Thu Mar 22, 2012 9:04 am 
Newbie

Joined: Thu Mar 22, 2012 8:55 am
Posts: 1
Hi,

After doing some research I decided to use hibernate
The implementation and configuration was very easy and fast via maven & net beans.

The problem start when I try to run the first HQL query.
Apparently hibernate does not like the fact that version can use for field name :

Quote:
java.lang.ClassCastException: org.hibernate.type.BigDecimalType 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 org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)


So I change the fields name to “abc” something like this:

Code:
private BigDecimal abc;
public BigDecimal getAbc() {
        return this.abc;
    }
   
    public void setAbc(BigDecimal abc) {
        this.abc = abc;
    }

<version name="abc" type="big_decimal">
<column name="VERSION" precision="22" scale="0" />
</version>


But then I got the following error:

Quote:
org.hibernate.PropertyNotFoundException: Could not find a getter for abc in class com.cra.hbm.pojo.CMapping
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275)
at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:168)
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 org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)


is there any workaround for this scenario ?

Thanks


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

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.