Bugs item #1019591, was opened at 2004-08-31 14:30
Message generated for change (Comment added) made by loubyansky
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1019591&group_id=22866

Category: JBossCMP
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Juan Martinez (juanmartinez)
Assigned to: Alexey Loubyansky (loubyansky)
Summary: Multiple CMRs in same tx

Initial Comment:
Hi.  
  
I've 3 entities which are in the following relationship:  
  
 A 1 -<->- * B * -->- 1 C  
  
and a method in session facade which creates a A entity and a lot  
of B entities. The C entities exists before the facade method is  
called.  
  
What happens is this:  
  
1) A is created  
2) Another method is called which creates B's with different  
properties (and sub-methods)  
3) The B is created with a reference to C (set is called in  
ejbPostCreate)  
4) The newly created B's are then assigned to A  
  
All tx attributes are set to "Required" in case of a failure  
somewhere under the creation.  
  
Inside the facade tx I can see that all B's has a reference to C.  
  
When the facade method completes a check to the database  
shows that only the last B's reference to C is set.  
  
That is:  
  
During facade tx (bean level):  
 B1 -> C1  
 B2 -> C1  
  
After facade tx (and in database):  
 B1 -> NULL  
 B2 -> C1  
  
A find call after the facade method shows this as well (b1.getC() 
== null && b2.getC() != null). CMP fields are fine in both cases. 
 
The A <-> B relationships are fine. 
 
All primary keys in A, B, and C are based on PostgreSQL 
sequences. The reference between the entities are based on 
sql-/jdbc-type INTEGER. 
 
The tests have been run on 3.2.6RC1 and 4.0.0RC1 -- not the 
branches, sorry. I searched the closed bug reports for 3.2.6RC2 
couldn't a match for this case. 
 
The container is run with default setup (COMMIT B). 
 
I can try and make a testcase if needed -- the original code 
creates 1000's of entities and have a lot more dependencies. 
 
Let me know if I can provide more information. 
 Juan 
 

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

>Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-09-14 13:00

Message:
Logged In: YES 
user_id=543482

Could you try to apply this fix? Thanks.

RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/keygen/JDBCPostgreSQLCreateCommand.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDBCPostgreSQLCreateCommand.java  11 Aug 2004
14:09:07 -0000  1.4
  +++ JDBCPostgreSQLCreateCommand.java  14 Sep 2004
09:50:51 -0000  1.5
  @@ -54,7 +54,7 @@
         }
      }
   
  -   protected int executeInsert(PreparedStatement ps,
EntityEnterpriseContext ctx) throws SQLException
  +   protected int executeInsert(int index,
PreparedStatement ps, EntityEnterpriseContext ctx) throws
SQLException
      {
         int rows = ps.executeUpdate();
   


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

Comment By: Juan Martinez (juanmartinez)
Date: 2004-09-04 13:30

Message:
Logged In: YES 
user_id=870070

I managed to create a testcase based on only the B's and C's. 
 
You'll need jbossall-client.jar and XDoclet libs in the lib 
directory. 
 
Sorry for the  delay -- let me know if I can help with 
something. 
 Juan 

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

Comment By: Juan Martinez (juanmartinez)
Date: 2004-09-01 14:39

Message:
Logged In: YES 
user_id=870070

insert-after-ejb-post-create hasn't been changed, so it's false. 
 
I'll try and make a testcase for you. 

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

Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-08-31 15:23

Message:
Logged In: YES 
user_id=543482

Is insert-after-ejb-post-create true? In other words, is the
valid primary key available after ejbCreate but before
ejbPostCreate?
A testcase would help.

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

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


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to