Bugs item #850859, was opened at 2003-11-28 21:34 Message generated for change (Comment added) made by loubyansky You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=850859&group_id=22866
Category: JBossCMP Group: v3.2 Status: Open Resolution: None Priority: 5 Submitted By: Sandro Santos Andrade (sandros) >Assigned to: Alexey Loubyansky (loubyansky) Summary: CMP-Engine changing primary-key field value ??? Initial Comment: Hi all, I have two entities 'SystemUser' (primary key 'login') and 'Author', where author's primary-key is composed by an foreign-key to systemuser's primary-key and a string field fullName. I create in author a field that is both cmp-field and cmr-field and did all relationship configurations. All table were successfully created with primary-key and foreign-key constraints (PostgreSQL): Table "public.systemuser" Column | Type | Modifiers ----------+------+----------- login | text | not null fullname | text | not null password | text | not null Indexes: pk_systemuser primary key btree (login) Table "public.author" Column | Type | Modifiers ----------+------+----------- login | text | not null fullname | text | not null name | text | not null address | text | not null Indexes: pk_author primary key btree (login, fullname) Foreign Key constraints: fk_author_login FOREIGN KEY (login) REFERENCES systemuser(login) ON UPDATE NO ACTION ON DELETE NO ACTION But, the accessor setLogin(x), where x is the LocalInterface for systemuser with primary-key = 'sandros', in entity Author throws the following error: "Could not create entity:java.sql.SQLException: ERROR: fk_author_login referential integrity violation - key referenced from author not found in systemuser", but record 'sandros' exists in systemuser table. If I delete the constraint fk_author_login in table author, the record inserted is: login | fullname | name | address --------------------------+-----------------------+----------------+--------- local/SystemUser:sandros | Sandro Santos Andrade | Andrade, S. S. | UFBa That is, the systemuser's primary key (login) is being 'local/SystemUser:sandros' rather than just 'sandros' If the cmr-field login is not part of primary key the insert occurs all right. Any idea ? I'm using jboss 3.2.2rc2, jdk 1.4.2 in Debian kernel 2.4.18 and postgresql 7.3.4. Thanks in advance, Sandro ---------------------------------------------------------------------- >Comment By: Alexey Loubyansky (loubyansky) Date: 2003-11-28 21:53 Message: Logged In: YES user_id=543482 The result inserted is the result of EJBLocalObject.toString(). It looks like there is a CMP and a CMR fields with the same name which is impossible (following the spec) because you would not be able to compile the bean class. Are you declaring a cmp-field as a cmr-field in ejb-jar.xml? You can have a foreign key of a cmr field mapped to a primary key field but not cmr itself. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=850859&group_id=22866 ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ JBoss-Development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development