Reputation: 664
I've got a client
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "cl_id")
private Long clId;
@JoinColumn(name = "vl_id", referencedColumnName = "vl_id")
@ManyToOne
private City cityId;
Whenever I create a new client this way:
Client c = new Client();
c.setCityId(new City());
and persist it. The city isn't persisted also if it doesn't exist. Wouldn't the city be persisted also unless the City object has got an Id ?
Upvotes: 0
Views: 61