Answer the question
In order to leave comments, you need to log in
Is there an equivalent of lookup fields in hibernate/java ORM?
Good time of the day! It is required to rewrite a delphi application in java using swing (it is it, not fx).
While writing, studying and everything else, there were problems and questions related to the operation of the database. The fact is that in Delphi it was possible to use lookup fields (to display the value), but how to deal with this in java is not clear. Writing native queries to the database is also not an option. Too bulky tables, everything is interconnected, something always refers to something. I want to make my life easier.
Questions:
Answer the question
In order to leave comments, you need to log in
If a lookup field means a related entity, then see the @ManyToOne or @OneToOne annotations. Something like:
@Entity
public class City {
private String name;
}
@Entity
public class Person {
@ManyToOne
private City city;
}
// и где-то:
person.getCity().getName();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question