Olete.in
Articles
Mock Tests
🧪 JPA MCQ Quiz Hub
JPA MCQ
Choose a topic to test your knowledge and improve your JPA skills
1. What are the JPA @Entity association attributes?
Association validation
Association multiplicity
Association cascade behavior
Association direction
2. JPA implementation is provided by ---?
Hibernate
Toplink
Ibatis
All of them
3. ______ has stated that ideas came from several frameworks, including Hibernate and JDO.
Sun Microsystems
Java (software platform)
Open JDK
Java (programming language)
4. What is the Life Cycle Of A Jpa Entity?
New / Transient
Managed / Persisted
Detached
All of the above
5. What's true about the following @Entity association between House and Window? @Entity public class Window { @Id private int winNo; @ManyToOne private House aHouse; } @Entity public class House { @Id private int houseNo; @OneToMany(mappedBy="aHouse") private List windows; }
It's OneToMany unidirectional association
It's OneToMany bidirectional association
The association owner is the House class
The association owner is the Window class
6. Which annotation is used to create Pk-Fk relation b/w two tables?
JoinColumn
ForeignKey
JoinedKey
None of these
7. Object/relational metadata can be specified directly in the entity class file by using annotations, or in a separate ________ descriptor file distributed with the application.
Scalable Vector Graphics
HTML
XML
XHTML
8. What is TRUE about the cascading and cascade mode attributes in Entity Beans?
Cascade mode attributes can be specified for the association annotaions (like @OneToMany) in an entity bean
The cascading direction is from the target entity to the source entity
Refresh cascade causes to refresh the target entities of a relationship when refresh is invoked on the source entity of the relationship
PERSIST, DELETE and REFRESH are cascading mode attributes
9. Which attribute of @OneToMany is used to mark an entity as owned?
cascade
mappedBy
propertyRef
None of the above
10. What is the JPA equivalent of hibernate.cfg.xml file?
configuration.xml
persistence.xml
jpa.configuration.xml
jpa.configuration.xml
Submit