-->
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.  [ 5 posts ] 
Author Message
 Post subject: invalid mapping
PostPosted: Thu Nov 10, 2005 12:21 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 1:03 pm
Posts: 38
I get this error with the following xml:

<primitive-array name="props">
<list-index column="sortIndex"/>
</primitive-array>

org.hibernate.MappingException: invalid mapping
The content of element type "primitive-array" must match "(meta*,subselect?,cache?,synchronize*,comment?,key,(index|list-index),element,loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?)".

** props is the name of my property defined as: double[] props - in my class

** I picked an arbitray name for the index column. I'm not sure how to get the index column of the property table.

Can someone tell me what I should be doing to map this class property array?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 12:39 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 1:03 pm
Posts: 38
the Java type of a property holding a collection must be the interface type (ie. Map, Set or List; never HashMap, TreeSet or ArrayList). This restriction exists because, when you're not looking, Hibernate sneakily replaces your instances of Map, Set and List with instances of its own persistent implementations of Map, Set or List

does this mean I can't use double[][] as a datatype for a persistent property or does it mean that Hibernate will convert the double[][] to Array?

This is very confusing and I can't find anything in the documentation abot it!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 11, 2005 8:12 am 
Beginner
Beginner

Joined: Fri Oct 28, 2005 10:46 am
Posts: 37
Regarding your exception, did you read the message? key, index|list-index, and element are all required. What is "Array"? Hibernate handles arrays as arrays as far as I know. It can't and doesn't do anything unusual with them. I'd recommend staying away from them, though, since you won't get the optimizations available from using a Collection type. I'm not sure if/how Hibernate handles nested arrays, though.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 6:47 am 
Newbie

Joined: Tue Aug 15, 2006 5:38 am
Posts: 2
Location: Ukraine
hi!

it is very interesting for me: have you solved this problem or not?
I have a similar problem. I have a class and such a field in it:

public double[] arrOfDoubles;

getter;
setter;

I use xdoclet for hibernate mapping. I tried to use a lot of variants of tags description, but nothing helps.
For example:
/**
* @hibernate.primitive-array table="doubles" cascade="all"
* @hibernate.collection-key column="parentId"
* @hibernate.collection-element column="value" type="double"
* @hibernate.collection-index column="id"
* @hibernate.collection-one-to-many
* @return
*/
Where is the same exception in any way:

[hibernatedoclet] org.xml.sax.SAXParseException: The content of element type "primitive-array" must match "(meta*,subsel
ect?,cache?,synchronize*,key,(index|list-index),element,loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?)".

What do I do wrong? Can anybody help me?
Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 24, 2006 4:22 am 
Newbie

Joined: Tue Oct 17, 2006 12:11 am
Posts: 1
I am new in this forum, I could get the type of error. the problem were the order of tags in *.hbm.xml configuration file


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