You are on page 1of 2

What is ORM?

B. Object Relational Mapping

Hibernate is an?
A. Open Source
B. Lightweight
C. ORM
D. Both A, B and C

Which of the following is the root node of hbm.xml file?


A. hibernate-mapping

Which of the following is FALSE about Session in hibernate:


You can share the session between threads

What does hibernate.hbm2ddl.auto = create this means?


A. create tables automatically

Which of the following is true about persistent state of a persistent entity?


A. You can make a transient instance persistent by associating it with a Session.
B. A persistent instance has a representation in the database.
C. A persistent instance has an identifier value.
D. All of the above.

Which element of hbm.xml is used to map a Java class property to a column in the
database table?
C. property

Q 15 - Which of the following is true about @Entity annotation?


A - @Entity annotation marks a class as an entity bean.
B - Class marked with @Entity annotation must have a no-argument constructor that
is visible with at least protected scope.
C - Both of the above.
D - None of the above.

if entity is not annotated with @table what will happen


B. No error and class name is mapped with table name.

Can embeddable class be used as primary key?


A. Yes

Which of the following methods returns proxy object?


C. Load()

Load child object automatically when parent object is loaded?


Lazy = TRUE

Which attribute of @OneToMany is used to mark an entity as owned?


mappedBy

Which method is used to save the state of the given instance from the underlying
database?
Session.save

Which of the following method is used inside session only?


Update()

Q 20 - Which of the following is true about Query object in hibernate?


A - Query objects Hibernate Query Language (HQL) string to retrieve data from the
database and create objects.
B - Query objects SQL string to retrieve data from the database and create objects.
C - A Query instance is used to bind query parameters, limit the number of results
returned by the query, and finally to execute the query.
D - All of the above.

Session.createQuery creates a new instance of Query for the given HQL query string.
A.TRUE

Which of the following is not an advantage of Hibernate Criteria API?


B. Cannot order the result set

Hibernate Named Query can be defined in Hibernate mapping files or through the use
of JPA annotations:
A. @NamedQuery
B. @NamedNativeQuery
C. A and B

Hibernate caching improves the performance of the application by pooling the object
in the cache.
TRUE

Hibernate SessionFactory represent which level of cache?


A. Second Level

Which tetching strategy tuned query automatically?


session.createCriteria();

Session.beginTransaction method begins a unit of work and returns the associated


Transaction object?
True

You might also like