-->
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: How to change type mapping for JPA ?
PostPosted: Thu Nov 06, 2008 4:46 am 
Beginner
Beginner

Joined: Mon Jan 10, 2005 7:14 am
Posts: 32
Hi,

I use Hibernate as JPA implementation for unit tests on a HSQDLB database. But I encounter problems running a query that has a where clause on a float property, it returns no results.

My query is as following :

Code:
select ev.element from ElementValue ev where ev.data = :data and ev.floatValue = :floatValue


I defined my column this way :

Code:
@javax.persistence.Column(name = "FLOAT_VALUE_", insertable = true, updatable = true)
public java.lang.Float getFloatValue()
{
    return floatValue;
}


If I run this query on a MySQL database, it works perfect. Using Hibernate console, I could make my query work on HSQLDB but I had to set the query parameter floatValue as a double instead of a float. So I think there is a problem with the way float properties are mapped with HSQDLB.

I saw you can force the column type within the @Column annotation, but I don't want to do this because my entities have to be database independant. So is there a way to change the type mapping for HSQLDB at runtime, for example in a config file ?

Thanks in advance

Olivier


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.