Home / CSE MCQs / JPA ::

CSE MCQs :: JPA

  1. What are the JPA @Entity association attributes?
  2. A.
    Association validation
    B.
    Association multiplicity
    C.
    Association cascade behavior
    D.
    Association direction

  3. JPA implementation is provided by ---?
  4. A.
    Hibernate
    B.
    Toplink
    C.
    Ibatis
    D.
    All of them

  5. ________ has stated that ideas came from several frameworks, including Hibernate and JDO.
  6. A.
    Sun Microsystems
    B.
    Java (software platform)
    C.
    Open JDK
    D.
    Java (programming language)

  7. What is the Life Cycle Of A Jpa Entity?
  8. A.
    New / Transient
    B.
    Managed / Persisted
    C.
    Detached
    D.
    All of the above

  9. 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;
    }
  10. A.
    It's OneToMany unidirectional association
    B.
    It's OneToMany bidirectional association
    C.
    The association owner is the House class
    D.
    The association owner is the Window class

  11. Which annotation is used to create Pk-Fk relation b/w two tables?
  12. A.
    JoinColumn
    B.
    ForeignKey
    C.
    JoinedKey
    D.
    None of these

  13. 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.
  14. A.
    Scalable Vector Graphics
    B.
    HTML
    C.
    XML
    D.
    XHTML

  15. What is TRUE about the cascading and cascade mode attributes in Entity Beans?
  16. A.
    Cascade mode attributes can be specified for the association annotaions (like @OneToMany) in an entity bean
    B.
    The cascading direction is from the target entity to the source entity
    C.
    PERSIST, DELETE and REFRESH are cascading mode attributes
    D.
    Refresh cascade causes to refresh the target entities of a relationship when refresh is invoked on the source entity of the relationship

  17. Which attribute of @OneToMany is used to mark an entity as owned?
  18. A.
    cascade
    B.
    mappedBy
    C.
    propertyRef
    D.
    None

  19. What is the JPA equivalent of hibernate.cfg.xml file?
  20. A.
    configuration.xml
    B.
    persistence.xml
    C.
    jpa.configuration.xml
    D.
    None