is there a way to programatically determine the EJB entity class and id column from the table name?

StackOverflow https://stackoverflow.com/questions/4540160

  •  13-10-2019
  •  | 
  •  

Question

is there a way to programatically determine the EJB entity class and id column from the table name?

I have the table name, what I want is a way to get the entity class name and the name of the id column from the table name.

Is this possible?

Each entity class does have annotations describing the table name as well as which field is the identity column.

Thanks

Was it helpful?

Solution

You can use reflection and iterate through all ejb to find correct match for that name.

You must know that one table can be mapped to more the one entity and vice versa.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top