Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jada Mohammad   on Oct 31 In Java Category.

  
Question Answered By: Skye Hughes   on Oct 31

Try this:

@ManyToOne(optional=true, cascade={PERSIST, MERGE})
@JoinTable(name="CONTRACT_TABLE", joinColumn=@JoinColumn(name="FOREIGN_KEY_IN_CONT_TABLE"))
private Contract contract


As you said this is a unidirectional relationship so you need to persist or merge the other side of this relationship in a way, to do this you have to use 'cascade' attribute as above

Share: