javaejbejbql

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


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


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.