[ http://jira.jboss.com/jira/browse/JBAS-1361?page=history ]
Scott M Stark reassigned JBAS-1361: ----------------------------------- Assign To: Alexey Loubyansky (was: Scott M Stark) > Incorrect relations management > ------------------------------ > > Key: JBAS-1361 > URL: http://jira.jboss.com/jira/browse/JBAS-1361 > Project: JBoss Application Server > Type: Bug > Components: CMP service > Versions: JBossAS-3.2.6 Final > Environment: Jboss 3.2.6, Windows XP SP2, JVM 1.4.2_06, Oracle 9i > Reporter: Doychin Bondzhev > Assignee: Alexey Loubyansky > > > I discovered strange change in the behaiviour of relation collections after > jboss 3.2.3 > Here is what I have as starting point: > I have 2 entity beans. the first one hase relation to the second one (one to > many). The primary key for second bean cosits of 2 fields of type Integer and > Long. > so I get an instance of the first bean and get a collection of releated > instances of the second bean. > Collection c = bean1.getBean2(); > c.clear; > PriamryKeyCalss pk = new PrimaryKeyClass(); > pk.expiring = new Long(0); > for (int i = 0; i < newReleationIds.size(); i++) { > pk.id = (Integer)newReleationIds(i); > Bean2 bean2 = Bean2Home.findByPrimaryKey(pk); > c.add(bean2); > } > What I found is actually that wehn the bean2 instance is loaded from DB and > not from the read-ahead cache everything is fine. > In case bean2 instance is loaded from read-ahead-cache the primary key object > is reused and stored directly into new instance instead of creating new > instance of the primary key object. > So when I change the value of the ID field find new instance in c.add there > is a chekc which checks is this PK is already added in the collection. > Becouse of the object reuse it finds this PK object and returns. In jboss > 3.2.3 this was not the case. > A posible fix from my code that I found is to create new instance of the > primary key class for each call of the finder method. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-Development mailing list JBoss-Development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-development