Related differences

JDBC vs JPAJPA vs Hibernate

Ques 26. Mention the types of cache in JPA and their use.

There are two types of cache in JPA:

  • First-level cache: Data is cached from a single transaction.
  • Second-level transaction: Data is cached from more than one transaction.

Is it helpful? Add Comment View Comments
 

Ques 27. What is the purpose of access annotation?

The access type for an entity class, embeddable, superclass, or individual attributes is defined by it. This defines the way JPA refers to entity attributes such as class properties or class fields having setters and getters.

Is it helpful? Add Comment View Comments
 

Ques 28. What is the purpose of Basic annotation?

The simplest type of mapping of data on a column of the database is indicated by the basic annotation.

Also, the fetch field access strategy, as well as the requirement of the field, can be specified in the annotation parameters.

Is it helpful? Add Comment View Comments
 

Ques 29. List the six types of locks available in JPA specification in ascending order.

The six types of locks are listed below in the ascending order of their reliability:

  • NONE
  • OPTIMISTIC
  • OPTIMISTIC_FORCE_INCREMENT
  • PESSIMISTIC_READ
  • PESSIMISTIC_WRITE
  • PESSIMISTICI

Is it helpful? Add Comment View Comments
 

Ques 30. What options does JPA provide to set a second-level cache, or what values can be taken from the persistence.xml by the shared-cache-mode element?

The following five options are there:

  • ALL
  • NONE
  • ENABLE_SELECTIVE
  • DISABLE_SELECTIVE
  • UNSPECIFIED

Is it helpful? Add Comment View Comments
 

Most helpful rated by users: