-->
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.  [ 6 posts ] 
Author Message
 Post subject: Array & mapping
PostPosted: Thu Nov 13, 2003 9:38 am 
Beginner
Beginner

Joined: Thu Nov 13, 2003 9:27 am
Posts: 26
Location: France
Can I map an "array" in my java object with a "set" in the mapping hibernate ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 9:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You must use <array> to map an array.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 10:55 am 
Beginner
Beginner

Joined: Thu Nov 13, 2003 9:27 am
Posts: 26
Location: France
Thanks for our answer.

Then I've several questions :

- It seems that "set" are more used that "array". Why ? Aren't "Array" reliable ?

- Has someone already used "array" in a mapping ? Can he give me some hints ?

- What is, in our opinion, the best practice ? Convert my "java arrays" into "java sets" in order to use "hibernate set" or keep my "java arrays" and use "hibernate sets" ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 11:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Arrays can't be proxies. The JVM gives us no way to do this.

Use either <set>s or <bag>s for most associations.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 12:48 pm 
Beginner
Beginner

Joined: Thu Nov 13, 2003 9:27 am
Posts: 26
Location: France
What do you mean by proxies?
If I have an array in Java, why should I not use an <array> when mapping my objects and tables with Hibernate?

I just have the feeling most people use <set>s or <bag>s, and not so much <array>s? What do you think : are <array>s really used?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 1:54 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You can't do lazy loading of collection using <array> mapping (this is the proxy behavior). This is a major drawback. That's why Gavin recommends you set or bags in most cases

_________________
Emmanuel


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