Jpa(Engineering > Computer Science And Engineering ) Questions and Answers
Question 1. What are the JPA @Entity association attributes?
Association validation
Association multiplicity
Association cascade behavior
Association direction
Explanation:-
Answer: Option A. -> Association validation
Question 2. ________ has stated that ideas came from several frameworks, including Hibernate and JDO.
Sun Microsystems
Java (software platform)
Open JDK
Java (programming language)
Explanation:-
Answer: Option C. -> Open JDK
Question 3. JPA implementation is provided by ---?
Hibernate
Toplink
Ibatis
All of them
Explanation:-
Answer: Option D. -> All of them
Question 4. What's true about the following @Entity association between House and Window?@Entitypublic class Window {@Idprivate int winNo;@ManyToOneprivate House aHouse;}@Entitypublic class House {@Idprivate 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
Explanation:-
Answer: Option B. -> It's OneToMany bidirectional association
Question 5. What is the Life Cycle Of A Jpa Entity?
New / Transient
Managed / Persisted
Detached
All of the above
Explanation:-
Answer: Option D. -> All of the above
Question 6. Which annotation is used to create Pk-Fk relation b/w two tables?
JoinColumn
ForeignKey
JoinedKey
None of these
Explanation:-
Answer: Option A. -> JoinColumn
Question 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
Explanation:-
Answer: Option A. -> Scalable Vector Graphics
Question 8. What is the JPA equivalent of hibernate.cfg.xml file?
configuration.xml
persistence.xml
jpa.configuration.xml
None
Explanation:-
Answer: Option B. -> persistence.xml
Question 9. 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
PERSIST, DELETE and REFRESH are cascading mode attributes
Refresh cascade causes to refresh the target entities of a relationship when refresh is invoked on the source entity of the relationship
Explanation:-
Answer: Option A. -> Cascade mode attributes can be specified for the association annotaions (like @OneToMany) in an entity bean
Question 10. Which attribute of @OneToMany is used to mark an entity as owned?