-->
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: Persisting static collection
PostPosted: Thu Nov 09, 2006 9:04 am 
Beginner
Beginner

Joined: Fri Jun 09, 2006 4:21 pm
Posts: 23
Location: Reading
Hi,

I have a static collection of objects which I'd like to make persistent. Can you suggest how I can store this collection and then get a reference to it?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 3:10 pm 
Newbie

Joined: Tue Sep 19, 2006 4:13 am
Posts: 18
There are couple of things you can do about this:

1)Map the models normally as you do and as you want (in hbm)

2)Using Xml you can feed and load the static data directly into the databse.

You are all set , though be sure of the following things too:

1) Make the classes mutabe by mutable=true

2) Do use the secondary cache - ehcache is a good option of course with the mode as readonly (be careful here: sometimes in memory things do cause issues as they are tightly binded to Hibernate -specially when you use sqlz ).

3) For mappings - sometimes it is a good option to keep assosiations egaer (ie lazy=false)

Many a times it also makes sense to load all the static data on startup.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 09, 2006 5:31 pm 
Beginner
Beginner

Joined: Fri Jun 09, 2006 4:21 pm
Posts: 23
Location: Reading
Thanks for your reply. I now realise that I didn't uderstand what I actually wanted. I'd rather save the contents of the static collenction, than the collection itself.

But, anyway, can I persist single static collection object, after all?



*monu wrote:
There are couple of things you can do about this:

1)Map the models normally as you do and as you want (in hbm)

2)Using Xml you can feed and load the static data directly into the databse.

You are all set , though be sure of the following things too:

1) Make the classes mutabe by mutable=true

2) Do use the secondary cache - ehcache is a good option of course with the mode as readonly (be careful here: sometimes in memory things do cause issues as they are tightly binded to Hibernate -specially when you use sqlz ).

3) For mappings - sometimes it is a good option to keep assosiations egaer (ie lazy=false)

Many a times it also makes sense to load all the static data on startup.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 12, 2006 12:49 pm 
Newbie

Joined: Tue Sep 19, 2006 4:13 am
Posts: 18
Not sure why someone would want to persist a static collection.
Better look at the enum - i feel thats what you want!!


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.