-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add methods in Metamodel interface to get entity by jpa name #85
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@ptahchiev Commented |
|
Solution proposed in #448. |
Hello guys,
following this one:
https://www.java.net/forum/topic/glassfish/glassfish/how-obtain-class-j
pa-entity-name
and this one:
https://hibernate.atlassian.net/browse/HHH-9217
let's say I define an entity like this:
now I want to get the EntityType by the name value (by "car").
Unfortunately this seems to be impossible I can get hold of the
EntityManager and from there I can get the Metamodel interface, but in
there I can see only one method which accept a class object:
I would like to propose several new methods to be included:
It seems quite logical to get the entity by the name it was given
(otherwise what' really the purpose of this name). And, yes, I know
about the solution where you get all the entities and iterate in a loop
and compare their names with the one you have, but I guess you would
agree this is a really poor performancewise. Another plus to this is
that the underlying implementation would be super-easy: just keep the
jpaEntityNames in a map (even for hibernate I have provided a 1-line
patch).
Please let me know what you think.
Thanks, and keep up the good work.
The text was updated successfully, but these errors were encountered: