jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
206 stars 59 forks source link

Oracle JPA tutorial contains INCORRECT use of static metamodel #121

Closed lukasj closed 3 years ago

lukasj commented 8 years ago

See this page https://docs.oracle.com/javaee/6/tutorial/doc/gjiup.html

It says

"The following code snippet shows how to obtain the Pet entity’s metamodel class by calling Root.getModel: EntityManager em = ...; Root pet = cq.from(Pet.class); EntityType Pet_ = pet.getModel();"

Pet is the CANONICAL static metamodel and does NOT implement EntityType. This is utterly wrong. You get Pet by statically referring to it, and it is generated by an annotation processor.

The same tutorial even has @Static Metamodel(Pet.class) public class Pet_

{ public static volatile SingularAttribute<Pet, Long> id; public static volatile SingularAttribute<Pet, String> name; public static volatile SingularAttribute<Pet, String> color; public static volatile SetAttribute<Pet, Owner> owners; }

so it says Pet_ does not implement EntityType (and indeed is nothing to do with it).

This should be FIXED ASAP, or you will utterly confuse people

lukasj commented 6 years ago
lukasj commented 8 years ago

@glassfishrobot Commented Reported by neilstockton

lukasj commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JPA_SPEC-121

m-reza-rahman commented 3 years ago

This looks like a good candidate for a community/end-user contribution. I would suggest marking it with "good first issue" and/or "help wanted". That will help facilitate recruiting people to contribute. I would honestly also mark this low priority.

Reza Rahman Jakarta EE Ambassador, Author, Blogger, Speaker

Please note views expressed here are my own as an individual community member and do not reflect the views of my employer.

lukasj commented 3 years ago

moved to https://github.com/eclipse-ee4j/jakartaee-tutorial/issues/249