Bugs item #764511, was opened at 2003-07-02 12:53
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=764511&group_id=22866

Category: JBossServer
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Stefan Pohl (spohl)
Assigned to: Nobody/Anonymous (nobody)
Summary: New instance on every findByPrimaryKey() with the same key

Initial Comment:
I have a stringified number as primary key (containing 
leading "0"s), but want to be able to look up instances 
without the must to specify the leading "0"s.
Therefore I think the best place to validate/modify the 
wanted primary key would be in ejbFindbyPrimaryKey(). 
If the key (with "0"s added) doesn't exist it is common 
to throw a FinderException, but if it exists I can return a 
modified primary key (I found nothing about or against it 
in the ejb spec). JBoss supports this by storing the 
returned primary key and invoking bean methods with an 
EntityContext containing the modified key. This is good 
behaviour because such validation/modification code is 
called only once and must not be called in every bean 
method to translate the unmodified pk in the 
EntityContext.
Here is the problem: JBoss sets the modified pk in the 
EntityContext, but also to the map of already loaded 
identities. So every new call to findByPrimaryKey() with 
the same pk doesn't exist in the map and JBoss loads a 
new instance with the same data.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=764511&group_id=22866


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to