Beginner |
|
Joined: Fri Aug 27, 2004 1:59 pm Posts: 33
|
I have an Account which is mapped to a set of Positions. When a new Position is created I only want to update Account's set if Account is already loaded in the Session cache. In other words, I want to limit any locking on Account unless some other aspect of the system has already loaded/locked the Account.
I see that SessionImplementor has the method that I need: getEntity(Key). But the application has access only to Session. I searched around the code a bit can't seem find any other applicable method. Is there a clean (or cleaner) way to achieve the above than downcasting Session to SessionImplementor? Maybe with a custom proxy on the inverse relationship from Postion to Account that drops the methods on the floor if the Account is not loaded. (But it seems that this still requires access to SessionImplementor.)
thanks!
|
|