0% found this document useful (0 votes)
14 views

Quiz 3 - 2

Uploaded by

rita.jiang889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Quiz 3 - 2

Uploaded by

rita.jiang889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Question 1 (1 point)

Saved
What is the name of the file which stores the
configuration for Hibernate? Hint: Look inside
the src/main/resources folder of the sample
project Example-HibernateSE given in Week 4.
Question 1 options:

a) hibernate.cfg.xml

b) context.xml

c) persistence.xml

d) web.xml

Question 2 (1 point)
Saved
Which annotation is used to identify an instance variable
which corresponds to the primary key of a mapped table
on the database. This annotation is only used for single-
column primary key. Read online documentation:
https://docs.oracle.com/javaee/7/api/javax/persistence/Id.
html
Question 2 options:

a) @Basic

b) @Column

c) @GeneratedValue

d) @Id
Question 3 (1 point)
Saved
JPA annotations (such as @Id, @Column, @Transient,
etc.) should be placed on class member fields or on
property-style get methods but never both.
Question 3 options:
a) True
b) False
Question 4 (1 point)
Saved
Which annotation is used to map an instance variable to
its column on a table in the DB. Read online
documentation:
https://docs.oracle.com/javaee/7/api/javax/persistence/Co
lumn.html
Question 4 options:

a) @Column

b) @GeneratedValue

c) @Basic

d) @Id

Question 5 (1 point)
Saved
Hibernate sits between the database and Java
application. It is an implementation of JPA.
Question 5 options:
a) True
b) False
Question 6 (1 point)
Saved
Hibernate uses JDBC to connect to the database.
Question 6 options:
a) True
b) False
Question 7 (1 point)
Saved
Which annotation is used to let Hibernate/JPA know that
the primary key field or property of an entity is auto-
generated? Read online documentation:
https://docs.oracle.com/javaee/7/api/javax/persistence/Ge
neratedValue.html
Question 7 options:

a) @Column

b) @Id

c) @GeneratedValue

d) @Basic

Question 8 (1 point)
Saved
What is true about the @Table annotation? Read the
online documentation:
https://docs.oracle.com/javaee/7/api/javax/persistence/Ta
ble.html
Question 8 options:
a) All answers are true.

b) If no @Table annotation is used, then default values are used, that is, the entity class MyEntity wil
be mapped to the myentity table in the database if no @Table annotation is provided.

c) It allows you to define the name, schema, and catalog of the table for your entity mapping.

Question 9 (1 point)
Saved
What annotation is needed to mark a class as an entity to
be mapped by Hibernate/JPA? Read the online
documentation:
https://docs.oracle.com/javaee/7/api/javax/persistence/En
tity.html
Question 9 options:

a) @Table

b) @Entity

c) @NamedQuery

d) @Id

Question 10 (1 point)
Saved
Select all the states of an entity in Hibernate? (All or
nothing grading style, select the correct answers only.)
Question 10 options:
Persistent
Validation
Transient
UPDATE_MODEL_VALUES
Detached

Submit Quiz10 of 10 questions saved

You might also like