Forum Stats

  • 3,827,873 Users
  • 2,260,836 Discussions


Seeking Advice on 3-tier toplink usage

656264 Member Posts: 13
edited Sep 17, 2008 2:07PM in TopLink/JPA

I am having a typical web-application flow(JSP -> EJB -> DAO) and had questions around usage of toplink.

I read an object from session using namedQuery in one method..say getMyObject(). And then present the same to user. The user updates the object and I try to persist the same.

From all the mergeClone related posts in the I could find out that for this type of scenario, there are two options:-
- Always read the object using UOW so that we are not working on object from session cache
- OR use session.copyObject method when returning an object for user modification

Please let me know which approach is better from performance point of view.



  • From the performance viewpoint it is best to always read through a Session (or using a read-only query) when you want read-only objects, and read through a UnitOfWork when you want to modify the objects.

    James :
This discussion has been closed.