Farzane Sadeghi
Farzane Sadeghi

Reputation: 39

Find entity class by using its table name

I have the name of a table . I want to retrieve entity class of this table in Spring JPA. The table name may differ from its entity class name.

I searched for a lot, but the solutions were to find the table name using the entity class . That is, quite the inverse is what I need.

Do you have any suggestions for this problem?

Upvotes: 1

Views: 378

Answers (1)

Lesiak
Lesiak

Reputation: 25936

Assuming you know how to map entity class to a table name, you can get a list of all entity classes using JPA metamodel API, and subsequently build a complete inverse mapping.

Upvotes: 1

Related Questions