1 Reply Latest reply on Apr 18, 2003 2:28 PM by sys user

    Simple 1-1 ejb-relation problem

    sys user Master

      I'm having some problems getting a 1-1 relationship between 2 tables using JBoss CMP. The 1-1 relationship is between USERS and CUSTOMERS table. CUSTOMERS.EMAIL is a foreign KEY to USERS.USERNAME, which is also the PK of USERS table ... simple as that.

      Now when I map this to DB colums in jbosscmp-jdbc.xml, I could not find a way of how to tell JBoss to use the EMAIL column as the foreign key. I have this as ...


      IT seems to assume that it will create a new column on the CUSTOMERS table called CUSTOMERS.USERNAME to establish the relationship.

      When I let it create the tables automatically, it adds a USERNAME column on CUSTOMERS which is not how I want it to be. My database is already in place and I cant change the database structures, so I need to use the EMAIL column as the foreign key. How can I tell JBoss to use this as the FK ?