Bugs item #544437, was opened at 2002-04-16 10:00 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=376685&aid=544437&group_id=22866
Category: JBossCMP Group: v3.0 Rabbit Hole Status: Open Resolution: None Priority: 5 Submitted By: frederik sauer (fredsa) Assigned to: Dain Sundstrom (dsundstrom) Summary: FK not populated with CMR Initial Comment: The below example worked in 3.0.0beta2 and no longer works in RC1. Steps to reproduce: 1. Create two entity beans, "Parent" and "Child", each with a Long primary key (say "parentId" and childId") 2. Create bi-directional CMR parent-childeren using a Collection 3. Create a remotely accessible method in the Parent bean: public void addChildByPK(Long childPK) 3. Create a remotely accessible method in the Child bean: public void setParentByPK(Long parentPK) 4. In a test client show that this works as it should: a) create an instance of Parent b) create an instance of Child c) call parent.addChildByPK((Long) child.getPrimaryKey ()) d) select * from the child table and verify that the foreign key to the parent entity is populated 5. In a test client show that this is broken: a) create an instance of Parent b) create an instance of Child c) call child.setParentByPK((Long) parent.getPrimaryKey()) d) select * from the child table and verify that the foreign key to the parent entity is null I'm attaching a JAR file (includes source) which can be deployed. Included in the jar is a test client RelationshipTest.java. All files are in the java package "dummy". ---------------------------------------------------------------------- Comment By: Peter Ineson (pineson) Date: 2002-05-27 11:57 Message: Logged In: YES user_id=551148 I also have the same problem with 1-to-1 unidirectional relations using CMR. I have come across another possible workaround; it is to set the Transaction Attribute of the target bean in the relationship to 'RequiresNew'. In the example this would be Parent Bean, though I have not tried it on that particular example. ---------------------------------------------------------------------- Comment By: Tim McCune (javajedi) Date: 2002-05-15 18:38 Message: Logged In: YES user_id=62441 I am having this same problem. I did manage to stumble on a bizarre workaround for it. I manually populated the FK column on a single row in the database with an appropriate value using SQL. As soon as I did this, everything started behaving as it should. Every time I restart JBoss, I have to do this again to make stuff work. Very lame, but at least gets me to a usable state. This seems like a pretty serious bug. ---------------------------------------------------------------------- Comment By: Tim McCune (javajedi) Date: 2002-05-15 18:37 Message: Logged In: YES user_id=62441 I am having this same problem. I did manage to stumble on a bizarre workaround for it. I manually populated the FK column on a single row in the database with an appropriate value using SQL. As soon as I did this, everything started behaving as it should. Every time I restart JBoss, I have to do this again to make stuff work. Very lame, but at least gets me to a usable state. This seems like a pretty serious bug. ---------------------------------------------------------------------- Comment By: Leon Doud (ldoud) Date: 2002-05-04 00:31 Message: Logged In: YES user_id=489493 Please ignore my earlier comment about columns not being created. That was user error. ---------------------------------------------------------------------- Comment By: Leon Doud (ldoud) Date: 2002-04-23 05:22 Message: Logged In: YES user_id=489493 I'm experiencing the same problem with 1-to-1 unidirection relations using a FK and CMP. The column for the FK doesn't appear in the database table of the child. But all my 1-to-Many relations with a FK still work though. This used to work in beta 2 but no longer works in RC1. The beta 2 build I'm using is from 4/11. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=376685&aid=544437&group_id=22866 _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
