Bugs item #812723, was opened at 2003-09-25 13:58
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=812723&group_id=22866

Category: JBossCMP
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Gerald Turner (crazyfoam)
Assigned to: Nobody/Anonymous (nobody)
Summary: JBoss 3.2 many-to-one CMR bug with commit-option A

Initial Comment:
Hello I've found a bug that may have existed in 3.2 for

a while, notably

3.2.2RC4, but never on 3.0.  I've created a

light-weight stand-alone

test with only dependencies on Ant and JBoss jars on

the CLASSPATH.  It

can be viewed at

http://cvs.unzane.com/viewcvs.cgi/jboss32_null_cmr_bug/

and there is a link to download the whole tarball.



I'm encountering this bug all over the place in a real

app that has 51

CMP entity beans and has been running fine for over a

year on JBoss

3.0.x.  The test contains only two non-real-world

entity beans: Parent

and Child.  These beans use custom primary key classes,

otherwise the

bug cannot be exhibited.  There is a many-to-one

relationship from Child

(many) to Parent (one), defined by the

ChildEJB.getParentLocal method,

this side of the relationship is where the bug is at

(other directions

and multiplicites won't exhibit this bug).  These beans

and relations

run great except if I have code that wants to create an

"orphan", that

is a Child that has no Parent, i.e. the one-side is

null, for instance:



  orphan = childHome.create();



...JBoss 3.2 mysteriously (different than 3.0 behavior)

sets the CMR

with a dummy PK (with id 0), so the following expression:



  orphan.getParent()



...would normally return null (and does on JBoss 3.0,

and 3.2 with

default commit-option B), but instead returns a fake

Parent instance

when commit-option A is enabled.  Should note that even

with

commit-option B the dummy instance still exists for a

short time in the

ejbPostCreate for instance.



I believe the test is fairly comprehensive, the ejb.jar

even deploys 2

versions of each bean so both commit options can be

tested in one run,

here's an example session:



$ ant

Buildfile: build.xml



ejb-jar:

    [mkdir] Created dir:

/home/gturner/src/unzane/jboss32_null_cmr_bug/build/classes

    [javac] Compiling 13 source files to

/home/gturner/src/unzane/jboss32_null_cmr_bug/build/classes

      [jar] Building jar:

/home/gturner/src/unzane/jboss32_null_cmr_bug/build/jboss32_null_cmr_bug.jar



BUILD SUCCESSFUL

Total time: 2 seconds



$ cp build/jboss32_null_cmr_bug.jar

/usr/local/java/jboss/server/default/deploy    



$ ant test

Buildfile: build.xml



ejb-jar:



test:

     [java] Testing Standard CMP 2.x EntityBean

     [java] Creating Parent...

     [java] Calling Parent.toString...

jboss32_null_cmr_bug/Parent:5139960880366248960

     [java] Calling Parent.getId... 5139960880366248960

     [java] Creating Child...

     [java] Calling Child.toString...

jboss32_null_cmr_bug/Child:5240388961643827200

     [java] Calling Child.getId... 5240388961643827200

     [java] Calling Parent.addChild...

     [java] Calling Child.getParent...

jboss32_null_cmr_bug/Parent:5139960880366248960

     [java] Creating orphan Child...

     [java] Calling orphan Child.toString...

jboss32_null_cmr_bug/Child:6867513262540569600

     [java] Calling orphan Child.getParent... null

     [java] *** Orphan parent is null, good! ***



     [java] Testing Commit Option A EntityBean

     [java] Creating Parent...

     [java] Calling Parent.toString...

jboss32_null_cmr_bug/ParentOptionA:2399423911523140608

     [java] Calling Parent.getId... 2399423911523140608

     [java] Creating Child...

     [java] Calling Child.toString...

jboss32_null_cmr_bug/ChildOptionA:5548511049581539328

     [java] Calling Child.getId... 5548511049581539328

     [java] Calling Parent.addChild...

     [java] Calling Child.getParent...

jboss32_null_cmr_bug/ParentOptionA:2399423911523140608

     [java] Creating orphan Child...

     [java] Calling orphan Child.toString...

jboss32_null_cmr_bug/ChildOptionA:6479498120984856576

     [java] Calling orphan Child.getParent...

jboss32_null_cmr_bug/ParentOptionA:0

     [java] *** Orphan parent is not null, bad! ***

     [java] Expecting a FinderException from

ParentEJB.setParent, however if the following code

succeeds, then the non-exsitent Parent with id 0 will

keep growing children even though the database will

only have the Child records with null Parent

foreign-key column

     [java] Children of non-exsistent

jboss32_null_cmr_bug/ParentOptionA:0 before add orphan

Child

jboss32_null_cmr_bug/ChildOptionA:6479498120984856576: []

     [java] Children of non-exsistent

jboss32_null_cmr_bug/ParentOptionA:0 after add orphan

Child

jboss32_null_cmr_bug/ChildOptionA:6479498120984856576:

[jboss32_null_cmr_bug/ChildOptionA:6479498120984856576]



BUILD SUCCESSFUL

Total time: 2 seconds



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

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


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to