Die meistgefragten Interviewfragen und Antworten sowie Online-Tests
Lernplattform fur Interviewvorbereitung, Online-Tests, Tutorials und Live-Ubungen

Baue deine Fahigkeiten mit fokussierten Lernpfaden, Probetests und interviewreifem Inhalt aus.

WithoutBook vereint themenbezogene Interviewfragen, Online-Ubungstests, Tutorials und Vergleichsleitfaden in einem responsiven Lernbereich.

Interview vorbereiten

JPA Interviewfragen und Antworten

Verwandte Vergleiche

JDBC vs JPAJPA vs Hibernate

Frage 6. What is an Entity?

A class which should be persisted in a database it must be annotated with javax.persistence.EntitySuch a class is called Entity. 

An instances of the class will be a row in the person table. So, the columns in the person table will be mapped to the Person java object annotated as @Entity.
While insert, update or fetch record to or from the database we use entity as mapping with relational tables.

Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Frage 7. What is the difference between persistence.xml and hibernate.cfg.xml?

When using JPA need persistence.xml and while using Hibernate API need hibernate.cfg.xml. When using JPA or Hibernate not needed both xmls, need the xml configuration file according to JPA or Hibernate.

Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Frage 8. What is the difference between JPA and Hibernate?

Hibernate is one of the most popular open-source implementations of the latest specification (JPA 3.0). Even more likely the most popular, almost standard de facto.

That is, JPA only describes rules and APIs, and Hibernate implements these descriptions, however Hibernate (like many other JPA implementations) has additional features not described in JPA (and is not portable to other JPA implementations).

For solid differences, check JPA vs Hibernate.

Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Frage 9. What are the two types of elements in Entity classes?

JPA indicates that it can work both with properties of classes (property), designed in the style of JavaBeans, or with fields (field), that is, class variables (instance variables). Accordingly, the type of access will be either property access or field access.

Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Frage 10. What types of connections (relationships) between Entities?

There are four types of connections

  1. One-To-One: one-to-one connection, that is, one Entity object can be associated with no more than one object of another Entity
  2. One-To-Many: one-to-many connection, one Entity object can be associated with a whole collection of Entity
  3. Many-To-One: A relationship where one entity (column or set of columns) is/are referenced with another entity (column or set of columns) that contains unique values. In relational databases, these relations are applicable by using foreign key/primary key between tables.
  4. Many-To-Many: A relationship is a connection between two types of entities. In the case of a many-to-many relationship, both sides can relate to multiple instances of the other side. Note that it's possible for entity types to be in a relationship with themselves.

Bi-directional: A mapping is the most common way to model this relationship with JPA and Hibernate. It uses an attribute on the Order and the OrderItem entity. This allows you to navigate the association in both directions in your domain model and your JPQL queries.

Uni-directional: A mapping is an association between one persistence object and another one related persistence object. If one persistence object uses another and in back if other is not using the first persistence object then it becomes unidirectional.

Ist das hilfreich? Kommentar hinzufugen Kommentare ansehen
 

Am hilfreichsten laut Nutzern:

Copyright © 2026, WithoutBook.