• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 3 páginas
Examen

Java spring boot interview Questions And Answers Rated 100%!!!

Document preview thumbnail
Vista previa 1 fuera de 3 páginas

What is implementation and interface inheritance? - ANS check chatgpt What type of exception is a null pointer exception in Java? - ANS Null pointer exception is a type of runtime exception in Java. What are runtime exceptions in Java? - ANS exception that occur at runtime due to circumstances beyond control of programmer such as accessing null object reference, dividing by zero or trying to access an array element with an index that is out of bounds. Because runtime exceptions are unchecked exceptions, they do not need to be explicitly declared in the method signature or handled by the calling code. However you should check for null references using if (referenceVariable != null) before accessing them What are unchecked exceptions in Java? - ANS Unchecked exceptions are exceptions that are not checked at compile-time. This means the compiler does not require methods to declare them in their throws clause and it does not force you to handle them with try-catch blocks. Unchecked exceptions are derived from the 'RuntimeException' class which in turn is a subclass of Exception. Common unchecked exceptions: NullPointerException. Even though it is not thrown, you can still gracefully handle it in catch block. Unchecked exceptions, are typically thrown automatically by the JVM when a condition occurs such as dividing by zero. What is difference between Hibernate and JPA - ANS both manage persistence context and entity state but Hibernate is part of JPA implementation. Explain the difference between Session and QueryDSL - ANS Session is more low level and verbose compared to QueryDSL. What are some alternatives to using Session in Hibernate? - ANS Alternative provide higher-level abstractions: 1. Spring Data JPA 2. JPA EntityManager 3. Spring JdbcTemplate 4. Spring Data Jdbc 5. MyBatis 6. Spring Data Rest What is a Session in Hibernate? - ANS An interface to manage database operations and persistence contexts. Represents a single unit of work with database. Create, Read and Delete persistent objects, as well as manage transactions. What is difference between Session and EntityManager? - ANS EntityManager are higher level abstraction to Session. What is a database sequence? - ANS can be used to automatically generate primary key values What does the @Version annotation do in Hibernate? - ANS implements optimistic locking, which prevents concurrent updates from overwriting each other. What this means is if you have two transactions that want to update the same employee at the same time, it will not allow this to happen by throwing OptimisticLockException if one transaction already updated the version. Optimistic locking is a technique where instead of locking a database record during read or write operations, the app assumes that conflicts are unlikely to occur. When updates are made to a record, the application compares the version number of the record in the database with the version number of the record that the application has fetched. If they match, the application proceeds with the update and the version number is incremented in the database. If they do not match, it indicates that another transaction has modified the record since it was fetched and the application can handle the conflict accordingly.

Vista previa del contenido

Spring Cert 2024 | Chapter 4 | Data JPA
Exam Questions And Answers


What is a Spring Data Repository interface? - ANS Aims to significantly reduce the amount
of boilerplate code required to implement data access layers for various persistence stores.

How do you define a Spring Data Repository interface? [2] Why is it an interface not a class? -
ANS a) Define Entity Class
b) Create an Interface (@Repository)
==> Should extend 1/4 Repository types
==> Should be parametrized w/ Entity type

public interface UserRepo extends JpaRepository<User, Long>

What is the naming convention for finder methods in a Spring Data Repository interface [4]? -
ANS 1) Verb [1/6] - {get, read, find, query, stream, count}

2) Limiter (Optional)

3) Subject (Optional)

4) Predicate [2] - consists of...
==> a) Property (required)
==> b) Comparison (optional, default is "equals")

[JAY] Regarding Spring Data Repository Interface methods' naming conventions, what parts are
optional [2]?

What part of the Predicate is optional? What does it default to? - ANS 1) Limiter - "first",
"top", etc.
2) Subject - Since Repo-Type is already parameterized w/ correct type

Predicate - Comparison is optional (defaults to "equals")

How are Spring Data repositories implemented by Spring at runtime? - ANS JDK Dynamic
Proxy - Intercepts all calls to repository
==> Routes calls to default repository impl (SimpleJpaRepository)

Información del documento

Subido en
15 de noviembre de 2024
Número de páginas
3
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$10.79

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
DocLaura
4.2
(44)
Vendido
161
Seguidores
38
Artículos
6357
Última venta
1 mes hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes