I have two tables in my database, users and usercontact.  Users primary key is userId, 
UserContact primary key and foreign key use the userId from the Users table.  My 
deployment descriptor describing this relationship is below.  When I try to remove a 
user from the database I get the error reported below.  How do I describe the 
relationship so the container knows to remove the UserContact row prior to the Users 
row?

ejbjar.xml:
            <  !-- this is a One to One relationship -->
                <  ejb-relation>
                        <  ejb-relation-name>UserContact_userId<  /ejb-relation-name>
                        <  ejb-relationship-role>
                                <  description>UserContact has one Users<  
/description>
                                <  ejb-relationship-role-name>UserContact_has_Users<  
/ejb-relationship-role-name>
                                <  multiplicity>One<  /multiplicity>
                                <  relationship-role-source>
                                        <  
ejb-name>MSSQLServer2000MetaData_UserContact<  /ejb-name>
                                <  /relationship-role-source>
                                <  cmr-field>
                                        <  cmr-field-name>userId<  /cmr-field-name>
                                <  /cmr-field>
                        <  /ejb-relationship-role>
                        <  ejb-relationship-role>
                                <  description>one Users exists for UserContact<  
/description>
                                <  ejb-relationship-role-name>UsersRole<  
/ejb-relationship-role-name>
                                <  multiplicity>One<  /multiplicity>
                                <  cascade-delete/>
                                <  relationship-role-source>
                                        <  description>Users<  /description>
                                        <  ejb-name>MSSQLServer2000MetaData_Users<  
/ejb-name>
                                <  /relationship-role-source>
                        <  /ejb-relationship-role>
                <  /ejb-relation>

error:
2004-07-22 13:09:37,812 DEBUG 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCRemoveEntityCommand.MSSQLServer2000MetaData_Users] 
Executing SQL: DELETE FROM Users WHERE UserID=?
2004-07-22 13:09:37,828 ERROR 
[org.jboss.ejb.plugins.cmp.jdbc.JDBCRemoveEntityCommand.MSSQLServer2000MetaData_Users] 
Could not remove Primary key: Raghu
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]DELETE 
statement conflicted with COLUMN REFERENCE constraint 
'FK__UserConta__UserI__7C8480AE'. The conflict occurred in database 'MetaData', table 
'UserContact', column 'UserID'.



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3843006#3843006

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3843006


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to