1 Reply Latest reply on Jun 26, 2006 2:59 AM by Diego Savio

    Relationship and Foreing Key

    Diego Savio Newbie


      It's possible to create a relationship (1to1, MtoN, 1toN) between two object without creating the foreing key constraint in the "linking" column?


      Two Object, Person and Car. Suppose that a Person can have only 1 car at time. I make a 1 to 1 unidirectional association between Person and Car without ownership so Person can exist without a Car also Car can exist without a Person.


      @Table(name = "person")
      public class PersonEntity implements Person {


      private CarEntity car;


      @Table(name = car")
      public class CarEntity implements Car {



      If I Deploy this code i found a colunm in Person table ("Car_id") with the foreing key constraint on, so it's impossible to delete a car associated with a person and cathing the dangling reference by myself.
      Can i delete the foreing key constraint with Ejb annotation?