-->
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: Mapping a legacy T/F varchar2 column using annotations
PostPosted: Tue Jun 26, 2007 1:30 pm 
Newbie

Joined: Thu Dec 09, 2004 4:26 am
Posts: 19
Location: Yorkshire, UK
Moved from Hibernate Users forum, sorry.....

Can anyone tell me if there is the equivalent of type="true_false" when mapping a property using hibernate annotations?

Using the hbm mapping I used to have:
Code:
   <property name="included" column="RUN_FLAG" type="true_false"/>


With annotations it now looks like:
Code:
   @Column(name = "RUN_FLAG")
   private boolean included;


I can't find any clues. Can someone please point me in the right direction?

Thanks,
Tim


Hibernate version:
Core = 3.2.4.SP1
Annotations = 3.3.0 GA

Mapping documents:
Code:
...
   @Column(name = "RUN_FLAG")
   private boolean included;
...

Full stack trace of any exception that occurs:
Code:
ERROR - RequestCycle               - For input string: "F"
java.lang.NumberFormatException: For input string: "F"
   at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
   at java.lang.Double.valueOf(Double.java:447)
   at oracle.jdbc.driver.OracleStatement.getBooleanValue(OracleStatement.java:4500)
   at oracle.jdbc.driver.OracleResultSetImpl.getBoolean(OracleResultSetImpl.java:479)
   at oracle.jdbc.driver.OracleResultSet.getBoolean(OracleResultSet.java:1561)
   at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getBoolean(DelegatingResultSet.java:227)
   at org.hibernate.type.BooleanType.get(BooleanType.java:23)
   at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
   at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
   at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
   at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2046)
   at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1371)
   at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1299)
   at org.hibernate.loader.Loader.getRow(Loader.java:1197)
   at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:568)
   at org.hibernate.loader.Loader.doQuery(Loader.java:689)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   at org.hibernate.loader.Loader.doList(Loader.java:2211)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
   at org.hibernate.loader.Loader.list(Loader.java:2090)
   at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
   at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
   at org.springframework.orm.hibernate3.HibernateTemplate$5.doInHibernate(HibernateTemplate.java:533)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
   at org.springframework.orm.hibernate3.HibernateTemplate.loadAll(HibernateTemplate.java:529)

Name and version of the database you are using:
Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 26, 2007 4:15 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
@Type(type = "org.hibernate.type.TrueFalseType") should do the trick


Top
 Profile  
 
 Post subject: Perfect
PostPosted: Wed Jun 27, 2007 4:51 am 
Newbie

Joined: Thu Dec 09, 2004 4:26 am
Posts: 19
Location: Yorkshire, UK
That's exactly what I've been searching for and could not find. Thanks for the help.

Tim


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 29, 2007 10:49 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Actualy @Type(type="true_false") should do it as well

_________________
Emmanuel


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.