JPA Interviewfragen und Antworten
Verwandte Vergleiche
Frage 31. How can the JPA metadata that is the information about entity type, embeddable class, etc., be obtained?
The Metamodel interface is used by JPA for this purpose.
We can obtain this interface's object using the method of getMetamodel from an EntityManger or EntityMangerFactory.
Frage 32. What is a unique inheritance strategy not present in the JPA specification but present in Hibernate?
The implicit polymorphism strategy is present in Hibernate but it is not present in JPA.
Frage 33. What do you mean by JPQL (Java Persistence query language), and how does it differ from SQL?
- JPQL is almost similar to SQL, but the names of entity classes and attributes are used instead of the database columns.
- Also, the data types of entity attributes are used by the query parameters instead of database fields.
- There is automatic polymorphism in JPQL, unlike SQL. KEY, TREAT, VALUE, MAP, and ENTRY are some of the unique functions of JPQL.
Frage 34. What is polymorphism in JPQL queries?
This means that regardless of the inheritance strategy, the objects of all the descendant classes are returned in each entity request.
Frage 35. How can the polymorphism be turned off in JPQL?
We can use the TYPE function in the where condition for turning polymorphism off in JPQL.
Am hilfreichsten laut Nutzern:
- What is ORM in JPA?
- What is an EntityManager?
- What is the difference between persistence.xml and hibernate.cfg.xml?
- What is an Entity?
- Why to use JPA?