-->
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: double[] mapping problems
PostPosted: Fri Jun 16, 2006 4:08 am 
Newbie

Joined: Wed Jan 11, 2006 10:28 am
Posts: 19
Location: Fano, Italy
Hibernate version: 3.1.3

I'm unable to define a mapping for a simple double[] property!

I have in my code a property like:
private double standardParallel;
with getter and setter and mapped like:
<property name="standardParallel" />
using default hibernate management, and all works well with HSQLDB, ORACLE 9i and PostgreSQL 8.1.

I've tried to define better the mapping using:
<array name="standardParallel" name="SP_VALS" cascade="all">
<key column="sp_id"/>
<list-index column="sp_index"/>
<element type="double" column="SP_VAL"/>
</array>

But don't works.
The strange for me is that analyzind the default implementation of the property in PostgreSQL, the property seems to be managed a s a string!
Any suggestions?

P.S: sorry fot the maybe stupid question... ;)


Top
 Profile  
 
 Post subject: maybe this helps
PostPosted: Fri Jun 16, 2006 4:28 am 
Beginner
Beginner

Joined: Thu Apr 21, 2005 5:37 am
Posts: 45
Location: Switzerland
http://www.java2s.com/Code/Java/Hibernate/MapArrayForOneToManyMap.htm


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 16, 2006 4:31 am 
Newbie

Joined: Wed Jan 11, 2006 10:28 am
Posts: 19
Location: Fano, Italy
thanks for super-fast response ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 16, 2006 5:16 am 
Newbie

Joined: Wed Jan 11, 2006 10:28 am
Posts: 19
Location: Fano, Italy
The code you suggest me is the same in the hibernate source code used for array test.
It works, of course, well, but only for User defined class as the B class of the example, with one-to-many relation.
In my code i need to persist a value-type array, suc ah double[], and i'm unable to mapping this double[] property.
I'm currently using this mapping:

<array name="standardParallel" cascade="all" table="PPARAMS_STPARALLELS">
<key column="STPARALLELS_ID"/>
<list-index column="STPARALLELS_INDEX" />
<element type="double" column="PPARAMS_STPARALLEL" />
</array>

and when i test this code i retrieve the exception:

org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of it.terranova.metadata.iso19115.referencesystem.MD_ProjectionParameters.setStandardParallel
at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValuesWithOptimizer(PojoEntityTuplizer.java:215)
at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:185)
at ...

the setter is a simple:

void setStandardParallel(double[] _standardParallel)
{
this.standardParallel = _standardParallel;
}


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.