1/9
This set of flashcards covers key concepts related to JPA (Java Persistence API), including annotations, entity management, and database interactions.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is the purpose of META-INF/persistence.xml in JPA?
It is used to define the persistence provider and database connection settings for JPA.
Define the annotation @Entity in JPA.
It indicates that the class is a JPA entity and will be mapped to a database table.
What does the @Id annotation signify in a JPA entity?
It designates a field as the primary key for the entity.
What is the function of the @Transient annotation?
It specifies that a field should not be persisted to the database.
List the possible generation strategies available for JPA primary keys.
GenerationType.AUTO, GenerationType.IDENTITY, GenerationType.SEQUENCE, GenerationType.TABLE.
What is the purpose of the @Column annotation in JPA?
It allows customization of the mapping between an entity property and a database column.
Explain the @Temporal annotation and its use.
It is used for entity properties of type java.util.Date or java.util.Calendar to specify how dates should be handled.
What is the purpose of the @Version annotation in JPA?
It is used for optimistic locking to prevent lost updates by ensuring that only one transaction can update a record at a time.
What does the term optimistic locking mean in JPA?
A strategy that allows multiple transactions to read data simultaneously but provides a mechanism to prevent overwriting changes made by others.
What is a MappedSuperClass in JPA?
A superclass that provides a shared mapping for its subclasses, allowing them to inherit common fields and behavior.