-->
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.  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Tue Nov 21, 2006 8:05 pm 
Newbie

Joined: Tue Feb 07, 2006 8:17 pm
Posts: 19
Quote:
Providing you don't use any provider specific implementations that is... probably relying on TopLinks identity maps and a single application EntityManager would prevent you from switching to Hibernate JPA at a later time?


True.

Quote:
So is that feature available through JPA/TopLink essentials as well or just the full blown TopLink implementation?

Yep check the glassfish-persistence website.
Oracle donated toplink essentials to the glassfish project which is sun's reference implementation of J2EE5. So it's open source.

Quote:
It wasn't clear to me whether the cache they are talking about is equivalent to the JPA persistence context or something else. The cache overview describes TopLink as using two caches: a session cache and a unit of work cache. Do the identity map features you describe apply to both? Not sure. I guess I need to read more about the concept of sessions and caching in TopLink and then find out whether similar concepts apply to the JPA implementation.


As I understand it, the identity map ensures that within a single session, you always get the same object instance for each entity. So it relates to the session cache.
Not sure how this relates to the unit of work cache. Units of work are basically transactions right?

Tom.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 21, 2006 9:29 pm 
Newbie

Joined: Fri Sep 22, 2006 4:53 pm
Posts: 3
I asked about the TopLink caching features on the Glassfish persistence dev mailing list.

Apparently TopLink essentials is just focusing on the JPA implementation whereas TopLink commercial adds more features such as distributed second level cache, query cache, non-RDB mappings etc.

The person who responded stated that it is possible to utilize the caching features you pointed to (e.g. Weak Identity Map) with the JPA implementation but they only affect the 2nd level cache (referred to as the sesssion cache in the TopLink documentation). They do not apply to the JPA persistence context. The persistence context should apparently be maintained until it is cleared or closed according to JPA spec.

So this would mean that a single JPA Toplink EntityManager/session for an application would suffer from similar memory issues as trying to maintain a long lived Hibernate session.

Also, I don't think it would be possible to utilize the 2nd level cache to 'magically' keep the UI in sync as with JPA whenever you update a detached object (via merge), you get back a new object.

So I think the options are the same as before:

1. Maintain a single long lived session and manually evict objects when no longer needed (Don't think this is possible with JPA, only with raw Hibernate - and possibly raw Toplink) - probably difficult to manage.

2. Maintain a single long lived session and make sure you have lots of memory for all possible use cases ....? Unlikely.

3. Use single Entity Manager per interaction and handle reattaching objects as appropriate and events to update UI. This is essentially what you'd have to do if you were using a non-ORM approach.

I think we'll probably have to go for approach 3 - guess there is no such thing as a free lunch!

Thanks for your input though.
Martin


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 21, 2006 10:21 pm 
Newbie

Joined: Tue Feb 07, 2006 8:17 pm
Posts: 19
Interesting.

I think what I've been trying to communicate is something like this :
http://www.oracle.com/technology/products/ias/toplink/doc/10131/main/_html/sesun009.htm

You have to pay for this technology though.


Top
 Profile  
 
 Post subject: Re: session-per-application in a rich client an antipattern?
PostPosted: Wed Mar 07, 2012 6:04 am 
Newbie

Joined: Mon Sep 06, 2010 9:15 am
Posts: 4
You can use EclipseLink (http://wiki.eclipse.org/EclipseLink/Use ... e_Concepts) or ObjectDB, they support having the session automatically evict unreferenced unchanged objects.

Personally, I have never understood why one would design a persistence layer that can lazy load objects, but not automatically release them. Seems like only half a solution.

My best guess is that the use case with the most attention is those enterprisey web apps, and people keep forgetting about the old style fat clients.

As an example I would recommend trying to create an iPhoto-like Java application with Hibernate, that displays 100,000 photos in a continuous (non-paged) scroll view. This will be very hard without weak reference support in the session. You'll end up getting lost in a maze of evicts, merges, locks and updates. Basically Hibernate forces all the ugly work on you, instead of helping you, and you end up doing some kind reference tracking, something most of us thought they were done with when they started programming in Java.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 19 posts ]  Go to page Previous  1, 2

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.