-->
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: Persisting arrays
PostPosted: Thu May 10, 2007 9:50 am 
Beginner
Beginner

Joined: Sat Apr 07, 2007 4:42 pm
Posts: 24
Hi,

1)

I want to persist an class array. Hibernate wants an @IndexColum annotation.
How can I prevent this, I dont care about the order of the elements.

2) I want to persist boolean [] and String[]. It seems that hibernate stores this a blob with java serialization. How can I achive a custom format (CSV, XML, ...)?

Thx.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 12:26 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
if you don't care about ordering, don't use an array. There are bettern unordered containers in java

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 1:46 pm 
Beginner
Beginner

Joined: Sat Apr 07, 2007 4:42 pm
Posts: 24
Hi,

thanx for your reply!

Yes, I could use a Set, but the problem is, that the Entity belongs to an API which must be still compatible with Java 1.4 and must be strongly typed. So I cannot use Set/Collection etc.
Ok I will think about a wrapper in the DAO layer or @PostLoad/PrePersist methods.

Have you an idea about point 2) too?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 1:54 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you'd better use @CollectionOfElements and let the propary types be stored in a specific association table

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 2:04 pm 
Beginner
Beginner

Joined: Sat Apr 07, 2007 4:42 pm
Posts: 24
Hm, I think I forgot to say, that I want to use only JPA annotations.
Is it possible to configure this anywhere in xml?


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.