Jpa(Engineering > Computer Science And Engineering ) Questions and Answers

Question 1. What are the JPA @Entity association attributes?
  1.    Association validation
  2.    Association multiplicity
  3.    Association cascade behavior
  4.    Association direction
Explanation:-
Answer: Option A. -> Association validation





Question 2. ________ has stated that ideas came from several frameworks, including Hibernate and JDO.
  1.    Sun Microsystems
  2.    Java (software platform)
  3.    Open JDK
  4.    Java (programming language)
Explanation:-
Answer: Option C. -> Open JDK





Question 3. JPA implementation is provided by ---?
  1.    Hibernate
  2.    Toplink
  3.    Ibatis
  4.    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 { @Id private int winNo; @ManyToOne private House aHouse;}@Entitypublic class House { @Id private int houseNo; @OneToMany(mappedBy="aHouse") private List windows;}
  1.    It's OneToMany unidirectional association
  2.    It's OneToMany bidirectional association
  3.    The association owner is the House class
  4.    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?
  1.    New / Transient
  2.    Managed / Persisted
  3.    Detached
  4.    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?
  1.    JoinColumn
  2.    ForeignKey
  3.    JoinedKey
  4.    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.
  1.    Scalable Vector Graphics
  2.    HTML
  3.    XML
  4.    XHTML
Explanation:-
Answer: Option A. -> Scalable Vector Graphics





Question 8. What is the JPA equivalent of hibernate.cfg.xml file?
  1.    configuration.xml
  2.    persistence.xml
  3.    jpa.configuration.xml
  4.    None
Explanation:-
Answer: Option B. -> persistence.xml





Question 9. What is TRUE about the cascading and cascade mode attributes in Entity Beans?
  1.    Cascade mode attributes can be specified for the association annotaions (like @OneToMany) in an entity bean
  2.    The cascading direction is from the target entity to the source entity
  3.    PERSIST, DELETE and REFRESH are cascading mode attributes
  4.    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?
  1.    cascade
  2.    mappedBy
  3.    propertyRef
  4.    None
Explanation:-
Answer: Option B. -> mappedBy