-
1. Re: detach entity instances from the EJB container
bfo81 Aug 10, 2006 4:49 AM (in response to mrohad)No, there's no possibility for doing that. Why do you need it? :)
-
2. Re: detach entity instances from the EJB container
mrohad Aug 10, 2006 6:44 AM (in response to mrohad)I would like to cache some entity beans that their state changed once in a very long time.
why do I need them to be held by the container? -
3. Re: detach entity instances from the EJB container
pmuir Aug 10, 2006 7:04 AM (in response to mrohad)I think you can just cache them. They will automatically become detached, you can reatach them with em.merge(entity)
I suggest you take a look at the Hibernate Entity Manager and Hibernate Annotations reference manuals
http://docs.jboss.com/ejb3/app-server/index.html -
4. Re: detach entity instances from the EJB container
bfo81 Aug 10, 2006 7:08 AM (in response to mrohad)I'm not sure what you mean with "cache"...
If you want to make sure that they're up-to-date just call em.refresh(...) on the entities. -
5. Re: detach entity instances from the EJB container
pmuir Aug 10, 2006 8:16 AM (in response to mrohad)I suspect something like JBoss cache. Hibernate allows you to do query caching which might be of use here.
-
6. Re: detach entity instances from the EJB container
mrohad Aug 10, 2006 9:22 AM (in response to mrohad)lets say i've a codes table(code/value columns) of 200 cities
and I would like to cache this table because it's a constant table and I wouldn't like to read from the db everytime..
i've Cities Enitity bean , do you think that if I'll query all the list and put it in some static hashtable it won't effect the EJB container preformance?
Thanks -
7. Re: detach entity instances from the EJB container
pmuir Aug 10, 2006 9:39 AM (in response to mrohad)Yes, I think you are right, you do want to cache that list. But why build your own caching solution when there are lots out there already:
If you use JBoss EJB3/Hibernate
[url]http://docs.jboss.com/ejb3/app-server/Hibernate3/reference/en/html_single/index.html#performance[.url]
or the JBossCache stuff which is intergrated into Seam (probably in CVS) -
8. Re: detach entity instances from the EJB container
mrohad Aug 10, 2006 10:16 AM (in response to mrohad)those caches seem to complicated for my needs
I just need to cache 200 entity beans and retrieve some of them once in a while..(I never changed their content)
what do you think?would you use the Jboss cache for that?
whcih one? the tree cache of any other?