0 Replies Latest reply on Apr 10, 2006 1:56 PM by Doug Orr

    Optional one-to-many relationship

    Doug Orr Newbie

      I am trying to figure out how to map an optional one-to-many relationship in EJB3 annotation. For example, A Mechanic may be assigned to work on many Vehicles, put any particular Vehicle may or may not have an assigned Mechanic. In database terms the Mechanic foreign key can be null on the Vehicle table.

      I have tried to set this up as a One-To-Many but when I delete a Mechanic I want any assigned Vehicles to have their reference to the Mechanic set to null. Instead I get a transaction error.