Distributed Objects   «Prev  Next»

JPA Entities - Quiz

1. Which statement accurately describes a Jakarta Persistence entity?
Please select the best answer.
  A. It is a stateless session bean used to expose database rows as remote methods.
  B. It is a lightweight domain object whose state can be mapped to persistent data.
  C. It is a remotely shared object that clients access directly across the network.
  D. It is a data-transfer object that must not declare a primary key.

2. Which annotation identifies the primary-key field or property of a Jakarta Persistence entity?
Please select the best answer.
  A. @Column
  B. @Id
  C. @Version
  D. @PersistenceContext

3. A Product entity is managed in an active persistence context. What normally happens after application code changes its price?
Please select the best answer.
  A. The change is ignored unless the entity is converted to a DTO.
  B. The application must call EntityManager.update(product).
  C. The provider detects the managed change and synchronizes it during flush.
  D. The application must call merge(product) after every setter or domain method.

4. What is the purpose of an entity attribute annotated with @Version?
Please select the best answer.
  A. It generates the entity's primary-key value.
  B. It keeps the entity managed after the persistence context closes.
  C. It places a permanent pessimistic lock on the database row.
  D. It enables optimistic conflict detection for concurrent updates or deletes.