Hello
I'm new to JPA and using persistence in Java anyway and I have two questions I can't quite work out: I have generated tags as:
@JoinColumn(name = "UserName", referencedColumnName = "UserName")
@ManyToOne(optional = false)
private User userName;
@JoinColumn(name = "DatasetNo", referencedColumnName = "DatasetNo")
@ManyToOne(optional = false)
private Dataset datasetNo;
But in one of the constructors for the class, no reference is made to columns UserName or DatasetNo whereas all other columns in the class are referenced in the constructor.
Can anyone tell me why this is? Both columns UserName and DatasetNo are 'foreign keys' on the entity Visualisation which corresponds to a database table of the same name. I can't quite work out the ORM.
And when using entity classes, or POJO, is it better to have class variables like:
private User userName;
Where an instance of a class is specified or simply the key of that class instance like:
private String userName;
Thanks
Mr Morgan.