Author name: admin

Which tag is used in JSP to forward a request to another resource?

Java MCQ: Which tag is used in JSP to forward a request to another resource? a) <jsp:forward> b) <jsp:include> c) <jsp:param> d) <jsp:redirect> Answer: a) <jsp:forward> Explanation: The <jsp:forward> tag is used in JSP to forward a request to another resource, such as another JSP page, Servlet, or HTML page. This tag allows the current […]

Which tag is used in JSP to forward a request to another resource? Read More »

Which annotation is used to define a native SQL query in JPA?

Java MCQ: Which annotation is used to define a native SQL query in JPA? a) @SQLQuery b) @NamedNativeQuery c) @Query d) @NativeQuery Answer: b) @NamedNativeQuery Explanation: The @NamedNativeQuery annotation in JPA is used to define a native SQL query. This annotation allows you to write SQL queries that are specific to the database and execute

Which annotation is used to define a native SQL query in JPA? Read More »

Which annotation is used to mark a class as an entity listener in JPA?

Java MCQ: Which annotation is used to mark a class as an entity listener in JPA? a) @EntityListener b) @Entity c) @Listener d) @EntityListeners Answer: d) @EntityListeners Explanation: The @EntityListeners annotation in JPA is used to mark a class or method as an entity listener. Entity listeners are used to intercept entity lifecycle events such

Which annotation is used to mark a class as an entity listener in JPA? Read More »

Which annotation is used to mark an entity as read-only in Hibernate?

Java MCQ: Which annotation is used to mark an entity as read-only in Hibernate? a) @Immutable b) @Transient c) @ReadOnly d) @Entity Answer: a) @Immutable Explanation: The @Immutable annotation in Hibernate is used to mark an entity as read-only. When an entity is annotated with @Immutable, Hibernate will not allow any modifications to the entity’s

Which annotation is used to mark an entity as read-only in Hibernate? Read More »

What does the @Inheritance annotation in JPA specify?

Java MCQ: What does the @Inheritance annotation in JPA specify? a) It defines a column inheritance strategy b) It specifies the table inheritance strategy c) It marks an entity as abstract d) It defines a primary key generation strategy Answer: b) It specifies the table inheritance strategy Explanation: The @Inheritance annotation in JPA specifies the

What does the @Inheritance annotation in JPA specify? Read More »

Which JPA annotation is used to define a many-to-many relationship?

Java MCQ: Which JPA annotation is used to define a many-to-many relationship? a) @OneToMany b) @ManyToMany c) @OneToOne d) @ManyToOne Answer: b) @ManyToMany Explanation: The @ManyToMany annotation is used to define a many-to-many relationship in JPA. This type of relationship means that multiple instances of one entity can be associated with multiple instances of another

Which JPA annotation is used to define a many-to-many relationship? Read More »

Which annotation is used to define a one-to-one relationship in JPA?

Java MCQ: Which annotation is used to define a one-to-one relationship in JPA? a) @OneToOne b) @OneToMany c) @ManyToOne d) @ManyToMany Answer: a) @OneToOne Explanation: The @OneToOne annotation is used to define a one-to-one relationship in JPA. This type of relationship indicates that one instance of an entity is associated with exactly one instance of

Which annotation is used to define a one-to-one relationship in JPA? Read More »

Which JPA annotation is used to define a one-to-many relationship?

Java MCQ: Which JPA annotation is used to define a one-to-many relationship? a) @ManyToMany b) @OneToOne c) @OneToMany d) @ManyToOne Answer: c) @OneToMany Explanation: The @OneToMany annotation is used to define a one-to-many relationship in JPA. This type of relationship indicates that one instance of an entity is associated with many instances of another entity.

Which JPA annotation is used to define a one-to-many relationship? Read More »

Which annotation is used to define a many-to-one relationship in JPA?

Java MCQ: Which annotation is used to define a many-to-one relationship in JPA? a) @OneToMany b) @ManyToOne c) @OneToOne d) @ManyToMany Answer: b) @ManyToOne Explanation: The @ManyToOne annotation is used to define a many-to-one relationship in JPA. This type of relationship means that many instances of an entity can be associated with one instance of

Which annotation is used to define a many-to-one relationship in JPA? Read More »

Which annotation is used to automatically generate primary key values in JPA?

Java MCQ: Which annotation is used to automatically generate primary key values in JPA? a) @AutoKey b) @Id c) @GeneratedValue d) @KeyGenerator Answer: c) @GeneratedValue Explanation: The @GeneratedValue annotation is used in JPA to automatically generate primary key values. This annotation is applied to the primary key field of an entity and allows the database

Which annotation is used to automatically generate primary key values in JPA? Read More »

What does JPA stand for?

Java MCQ: What does JPA stand for? a) Java Persistence API b) Java Platform API c) Java Performance API d) Java Process API Answer: a) Java Persistence API Explanation: JPA stands for Java Persistence API. It is a specification in Java that provides a standard for object-relational mapping (ORM) and data persistence. JPA allows developers

What does JPA stand for? Read More »

Scroll to Top