Share |

Hibernate Quiz

ORM stands for
Object Relational Mapping
Object Relational Matching
Over related Mapping
Over related Matching
hibernate.cfg.xml is used for
Building the mapping between class and table
Contains the configuration like database details
Is a generated file at runtime.
No such file is required for hibernate
Consider two class Company and Address.
Company can be a value and Address can be an entity
Company can be an entity and Address can be value.
No need to map these classes and Entity or value
Identifier of an entity is denoted by
@Id
@Identifier
@Key
@PrimaryKey
The most preferred way of defining primary key for a table is by using
Business Key
Composite Key
Natural Key
Surrogate Key
If the property of a class should not take part in persistence mechanism than the property should be marked as
@Enum
@Lob
@Temporary
@Transient
Which of the following is not a way to map the inheritance
Object Relational Mapping
Single Table per class hierarchy
Table per concrete class
Table per subclass
The disadvantage for using Single table per class hierarchy
Complex to handle polymorphic relationship.
Multiple tables to deal with.
Not null constraint cannot be applied.
Performance is not good.
In ManyToMany relationship, the link table is exposed as an entity
false
true
Hibernate does the dirty checking when the entity is in the following state
Detached
Persistent
Removed
Transient
The id value of a transient entity, if the type of id is Long is
arbitrary
not null
null
A transient entity referenced by a persistent entity can become persistent if the cascade option is cascade all
false
true
After the persistent context is closed the entity goes in the following state
Detached
Persistent
Removed
Transient
In a persistence context how many maximum object representing a particular database row can exist
A new object is created every time it is required
none
one
When all objects need to be removed from the persistence context, the call done is session is
clear()
evict(object)
remove(object)
In default flush mode, the flush is not called when
Before a query is executed
Commit of a transaction
None of the above
when flush is called explicitly
Which of the following is not an ACID property
Atomicity
Consistency
Dependency
Isolation
One of the following in not a transactional isolation issue
Dirty Read
Lost Update
No read
Unrepeatable read
Which of the following is the strongest transaction isolation level
Read Committed
Read Uncommitted
Repeatable Read
Serializable
Versioning is done by using which annotation marker
@Level
@Release
@V
@Version