-->
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: Constants object for clustered AS
PostPosted: Thu Jul 21, 2005 10:52 am 
Newbie

Joined: Wed Mar 09, 2005 11:32 am
Posts: 18
Hello All

I would like have an object which holds all of the application constants.

Some of those "constants" are changable (rarely).

How can I use Hibernate to create such an object?

remmeber that It needs to be one object and not object per constant.

Thank you.


Top
 Profile  
 
 Post subject: Re: Constants object for clustered AS
PostPosted: Thu Jul 21, 2005 10:56 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Shlomo wrote:
Hello All

I would like have an object which holds all of the application constants.

Some of those "constants" are changable (rarely).

How can I use Hibernate to create such an object?

remmeber that It needs to be one object and not object per constant.

Thank you.


Hibernate is a framework for accessing a relational database.

Unless these values are stored in tables the database, Hibernate is not the right tool for the job.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 2:39 pm 
Newbie

Joined: Wed Mar 09, 2005 11:32 am
Posts: 18
ohh, There is a table named "CONSTANTS" that holds all the contants of course.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 21, 2005 2:47 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Shlomo wrote:
ohh, There is a table named "CONSTANTS" that holds all the contants of course.


I actually see this more as a general design issue than a Hibernate issue but either way...

If the objects are updated through the app, and therefore using Hibernate, you can configure the L2 cache so that each time you "read" the object, hibernate will retrieve it from the cache instead of the database.

You could also just set up a HashMap that is accessible to the application through a static helper class or JNDI or however, which maps the keys to the Constant POJO objects.

The important decision comes from how the data in the application gets updated if the data in the database is modified outside of hiberate - if using the L2 Cache support, and how it gets updated in the HashMap if not.

With L2 Cache, updating through Hibernate should keep the cache properly maintained. If it is updated through some other mechanism, you can configure an expiration policy that will cause the cache to be invalidated/reloaded at specific intervals.

If you use a HashMap, you're on your own as far as keeping it current.


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.