Bugs item #764511, was opened at 2003-07-02 10:53 Message generated for change (Comment added) made by ejort You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=764511&group_id=22866
Category: JBossServer Group: v3.2 >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: Stefan Pohl (spohl) >Assigned to: Adrian Brock (ejort) 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. ---------------------------------------------------------------------- >Comment By: Adrian Brock (ejort) Date: 2003-07-02 11:03 Message: Logged In: YES user_id=9459 It is not the job of the container to provide this behaviour. You should write a primary key class that treats '0000000' the same as '0'. Implement equals(Object) and hashCode() to do this. Regards, Adrian ---------------------------------------------------------------------- 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
