-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate type Double vs double
PostPosted: Sat Dec 13, 2008 1:52 pm 
Beginner
Beginner

Joined: Wed Mar 21, 2007 10:23 am
Posts: 20
Hi there,

I'm currently facing a rather weird problem. I hope it won't be weird at all for you...

I wan to map a double[] java property and do the following :

Code:
<array name="prop" table="prop_table">
    <key column="id"/>
    <list-index column="prop_idx"/>
    <element column="prop" type="double" length="10" />
</array>


However, when I try to load the targeted entity, I get the following error :

Code:
ERROR - BasicPropertyAccessor$BasicSetter.set(118) | IllegalArgumentException in class: ..., setter method of property: ...
ERROR - BasicPropertyAccessor$BasicSetter.set(122) | expected type: [D, actual value: [Ljava.lang.Double;


It seems as if hibernate was returning a collection of Double (java.lang.Double) instead of one of double. Is it to you a known issue ? I'm using a mysql database in innoDB mode and the corresponding hibernate dialect.


Thanks in advance for your answers.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 14, 2008 7:14 am 
Beginner
Beginner

Joined: Wed Mar 21, 2007 10:23 am
Posts: 20
Hi,

For all the people interested in this matter, the answer was very easy... The correct mapping type for my double[] was the primitive-array and not the array.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 15, 2008 3:52 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
Please refer to :

http://www.hibernate.org/hib_docs/v3/api/org/hibernate/type/DoubleType.html

http://kickjava.com/src/org/hibernate/type/DoubleType.java.htm


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.