I have the following bean
@Entity
public class A {
@id
@generatedvalue
int id;
@Column(name="FIELD1")
private string field1;
@Autowired
private MyType field2;
//getters and setters
}
I also have a DAO class to access this bean. The application has a database with a table A and 2 fields, field1 and field2. The value that is stored in field2 in the database should be an id of field2, I can ask this via
field2.getId();
How should I annotate this in JPA?