2 Replies Latest reply on Oct 11, 2005 9:35 AM by Martin Ganserer

    ManyToOne Problem

    Martin Ganserer Novice

      Hello,

      I have a problem with a unidirectional ManyToOne-Relationship.

      
      ...
      class customer
      {
      ...
       @ManyToOne(fetch=FetchType.EAGER,optional=true)
       @JoinColumn(name="country",referencedColumnName="id")
       public Country getCountry()
       {
       return country;
       }
      


      When I try to persist a customer object I get following error:


       Cannot add or update a child row: a foreign key constraint fails
      10:54:20,265 INFO [STDOUT] ...; CausedByException is:
       Could not execute JDBC batch update


      Can somebody please help me?