Hi all. I have two entities:
@Entity
@Table(name = "MY_TABLE")
public class MyEntity
@Id
private Long id;
@ManyToOne(fetch = LAZY)
@JoinColumn(name = "COUN_MNEMONIC", referencedColumnName = "MNEMONIC")
private CountryEntity country;
...
@Entity
@Table(name = "COUNTRIES")
public class CountryEntity
@Id
private Long id;
@Column(name = "MNEMONIC")
private String mnemonic;
...
I have to have column COUN_MNEMONIC in first database table MY_TABLE.
When I try to fill and save entity MyEntity to database:
MyEntity myEntity = new MyEntity();
CountryEntity country = countryService.findByMnemonic(mnemonic);
myEntity.setCountry(country);
in database table MY_TABLE all fields are saved except MNEMONIC (MNEMONIC = null).
Do you have idea what is wrong in my implementation?
Please help.
Thanks.