Hi, Here's a problem that I have not been able to find a workaround to. I'd be thankful for any help/insights.
I have two cmp-ejbs A and B, that have a many-to-many CMR-relation. Starting from an instance of A i want to pre-load the related B-objects. I try to optimize this by adding <left-join> tags to jbosscmp-jdbc.xml. This works fine if there ARE some B-objects related to A , but if not i get an exception "Internal error setting instance field IdB". The reason seems to be that JBoss tries to initialize a B-object from a NULL-valued key-field. Here is the sql that JBoss produces (table-names edited by me for clarity): SELECT A.IdA, A.Description, B.IdB, B.Attribute FROM A LEFT OUTER JOIN AtoB ON A.IdA=AtoB.IdA LEFT OUTER JOIN Attribute B ON B.IdB=AtoB.IdB WHERE A.IdA=? Here, the fields AtoB.IdB and B.IdB and B.Attribute will be null when there is no match. So, JBoss tries to construct a B-object from the read-ahead resultset even if there is no such object! I have not tested if this happens also for empty one-to-many relations of if this is just a problem with many-to-many relations. I've tried to change the type of IdB to be Integer instead of int and hence allow null's. This works in a way, but requires that i also make all other fields in B (e.g the field B.Attribute) into something that can be null. I'e a B-object with all fields set to null will be created. I'm not sure i want that.. *** *** So, my questions are: *** *** Is there a workaround? *** Am I doing something wrong? *** Is this fixed in later versions. (I'm using JBoss 3.2.5) *** cheers, andreas View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3848454#3848454 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3848454 ------------------------------------------------------- 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. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
