Patches item #612033, was opened at 2002-09-20 09:30 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376687&aid=612033&group_id=22866
Category: JBossCMP Group: v3.2 Status: Open Resolution: None Priority: 5 Submitted By: Marian Kelc (mkelc) Assigned to: Nobody/Anonymous (nobody) Summary: CMR:foreign key as part of primary key Initial Comment: Hi folks! We are developers in a german telecomunications company and are using JBoss as application server for an internal project. One of our major problems with Jboss is a constraint in using foreign-keys as part of a primary-key together with cmr. We have observed in the forums that others have the same problem. As Dain Sundstrom stated, this is not a bug but merely a design-problem of the CMP-Engine/Specification (however). Since we are using a given database structure it would be really appreciated if we could use cmr to model the database relations. Unfortunately this structure makes heavy use of foreign keys that are part of primary keys. Instead of asking more silly questions we decided to have a look at the jboss sources. So we worked out a small patch that _seems_ to work. What we are doing is simply looking for fields that are used in the construction of sql statements more than once, removing them from the lists used for building the sql statements (look at the patch). We definitley know that this is a hack and not a real solution, but maybe, its an idea. Could someone test it? Tell us, if we are on the completly wrong way? Any side effects we are not seeing? However, we will continue to test it and would be happy for feedback of any kind. Thanx in advance, Andreas Ahrens, Marian Kelc PS: We first posted this message with patch to the forum, where Dain Sundstrom replied: "Post a patch at source forge. The other half of this problem is removal. The remove protocol (ejb spec) calls for the removal of the entity from all relationships before removal from the database. This means that the foreign key must be set to null." We will test the removal and then update the patch as soon as we can. A general Statement to say is, that, if the foreign key of a record is part of the primary key, then a cascade-delete of this record is a must. Having a constraint e.g. in oracle, the parent record otherwise even cannot be deleted since you will get a "contstraint violated, child record found". As we know, a Primary-Key field cannot be updated to NULL. To follow the philosophy in our patch we would simply look at the position in the code where the SQL-Statement is constructed and examine, if the updated field is part of the primary key. If cascade-delete is not set, an exception should be thrown ... Execute the patch at the top of the jboss-3.2beta source tree with patch -p1 or so ... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376687&aid=612033&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
