Elance Hibernate Test Answers 2015



JDBC stands for_____.

Java DataBase Connection
Java Does Best Connection
Jeremy Does Backflips Consistently
Just Do Both Carefully

 

 

Which one of the following statements is true about detached instance?

A persistent instance will become detached after the session is closed.
An instance will be detached after it gets retrieved from the database by the execution of query.
Changes made to the detached instance are still guaranteed to synchronize with the database.
Hibernate does NOT allow you to re-associate detached instances with a new persistence manager.

 

 

Which one of the following statements is NOT true about persistence annotations?

The @Column annotations is used to specify the column name of the foreign key
The @Entity annotation indicates that the class is mapped to a table in database
The @Table annotation can be used to specify mapping database schema name
The @Id annotation indicates the field is the primary key for the entity

 

 

Which one of the following statements is true?

The load() method can return a poxy than immediately hitting the database.
The get() method of Session interface will throw exception if no row find in the database
The load() method of Session interface will return null if no row find in the database
The load() method and get() method of Session interface are same

 

 

Which of the following does NOT correctly describe LockMode.NONE?

All objects switch to this lock mode at the end of a Transaction
If an object is requested with this lock mode, a WRITE lock will be obtained if it is necessary to actually read the state from the database
It represents the absence of a lock
Objects associated with the session via a call to update() or saveOrUpdate() also start out in this lock mode

 

 

Which of the following is not a Session method?

Session.save()
Session.saveorupdate()
Session.persist()
Session.remove()

 

 

Which of the following correctly describes org.hibernate.cache log category?

Log NEITHER first-level NOR second-level cache activity
Log all second-level cache activity
Log all first-level cache activity but NOT second-level cache activity
Log both first-level and second-level cache activity

 

 

Which of the following is NOT true about Second Level Cache?

It is called 'second-level' because there is already a cache operating in Hibernate for the duration of an open session
By default it effectively holds on to the identifiers for an individual query
It always "associates" with the Session Factory object
It exists as long as the session factory is alive

 

 

Which of the following is an INVALID LockMode?

OPTIMISTIC
OPTIMISTIC_FORCE_INCREMENT
PESSIMISTIC_FORCE_INCREMENT
UPDATE

 

 

Which of the following statement is TRUE about sorting in Hibernate?

A sorted collection is either sorted in-memory using java comparator or using order by clause at the database level
An order collection is either sorted in-memory using java comparator or using order by clause at the database level
A sorted collection is sorted in-memory using java comparator, while order collection is ordered at the database level using order by clause
An order collection is sorted in-memory using java comparator, while sorted collection is ordered at the database level using order by clause

 

 

Which of the following is NOT a type of hibernate cache?

Transaction layer level cache
Application layer level cache
SQL cache
First Level Cache

 

 

Which one of the following statements is NOT true about named queries?

The named query must be HQL strings. Native SQL is not supported in named query
Named queries are precompiled when session factory is created
Named queries allow externalizing query strings to the mapping metadata
The getNamedQuery() method obtains a query instance of named query

 

 

Which one of the following statements is NOT true about comparison operator in HQL?

The where clause is a logical expression evaluating to true false or null
You can use = NULL to test whether the value is null
The HQL where clause supports arithmetic expressions
The "like" operator allows wildcard(%) searches

 

 

Hibernate offers an implementation of which specification?

ORM
JPA
JDBC
JMS

 

 

Which one of the following statements is NOT true about ordering query result?

You cannot order query results by more than one properties
The default ordering is ascending
HQL provides an ORDER BY clause for ordering query result
You can use asc and desc to specify ascending and descending order

 

 

Which of the following provides an interface between application and data stored in the database?

Session
Transaction
ConnectionProvider
TransactionFactory

 

 

Which of the following is the FIRST Hibernate object that is created in any Hibernate application?

Configuration
SessionFactory
Transaction
Session

 

 

Which one of the following statement is NOT true about Hibernate's Query interface?

You can paging the query result by using setFirstResult() and setMaxResult() method
Both the createQuery() and createSQLQuery() method of Session interface can return a Query instance
You can use method chaining (methods return receiving object instead of void) with Query interface
If the query returns more than result for the uniqueResult() method, the first one will be returned.

 

 

Which of the following is NOT true about Session and Transaction scope in Hibernate?

In order to reduce lock contention in the database, a database transaction has to be as short as possible
Multiple instances of SessionFactory are created, usually on application startup, from a Configuration instance
A SessionFactory is an expensive-to-create, threadsafe object, intended to be shared by all application threads
A Session is an inexpensive, non-threadsafe object that should be used once and then discarded for: a single request, a conversation or a single unit of work

 

 

Which of the following is NOT a valid value for 'hbm2ddl.auto' property in hibernate configuration?

truncate
validate
update
create

 

 

Which one of the following statements is true about the instance states?

Persistent instants can be made transient by calling update()
Detached instants can be made persistent by calling saveOrUpdate()
Transient instants can be made persistent by calling delete()
Transient instants are previously persistent and associated with an unique session

 

 

Which of the following elements is used to declare the persistent class in Hibernate configuration file?

<property>
<mapping>
<session-factory>
<hibernate-configuration>

 

 

Which of the following correctly describes SessionFactory?

Instances of persistent classes that are not currently associated with a org.hibernate.Session
A single-threaded, short-lived object representing a conversation between the application and the persistent store
A thread-safe, immutable cache of compiled mappings for a single database
Short-lived, single threaded objects containing persistent state and business function

 

 

Which one of the following statement is NOT true about SessionFactory?

SessionFactory is not lightweight and is expensive to create
You can use SessionFactory to create Session instance
The SessionFactory caches generated SQL statements and other mapping meta data that Hibernate uses at runtime
One SessionFactory can manage more than one database

 

 

Which of the following is NOT true about Metamodel?

Handle to javax.persistence.metamodel.Metamodel can be obtained from either the javax.persistence.EntityManagerFactory or the javax.persistence.EntityManagervia their getMetamodel method
javax.persistence.metamodel.Metamodel acts as a repository of metamodel objects and provides access to them
All
The metamodel is a set of objects that describe a domain model

 

 

Which of the following are valid Hibernate interceptors?

Session-scoped
Both Session-scoped and SessionFactory-scoped
SessionFactory-scoped
Session-scoped but NOT SessionFactory-scoped

 

 

Which of the following property makes hibernate to generate SQL as per the chosen database?

session
dialect
driver_class
transaction

 

 

Which of the following is a VALID key component of Hibernate Configuration?

Database connection but NOT class mapping setup
Both database connection and class mapping setup
SessionFactory but NEITHER database connection NOR class mapping setup
Class mapping setup but NOT database connection

 

 

Which of the following property needs to be defined to activate second-level caching?

sessionFactory
hibernate-configuration
transactionManager
cache.provider_class

 

 

Which of the following is NOT true about default flush operation in Hibernate?

Hibernate NEVER flushes by default
Hibernate flushes by default before some queries
Hibernate flushes by default when session.flush() is executed
Hibernate flushes by default when commit() is executed

 

 

Which of the following is used by Hibernate to redirect the logging output to preferred logging frameworks?

JDK logging
Simple Logging Facade for Java (SLF4J)
JCL
log4j

 

 

Hibernate will assume an instance is an unsaved transient instance if:

The identifier property (if it exists) is null
You supply an unsaved-value in the mapping document for the class, and the value of the identifier property matches
All of these
The version property (if it exists) is null

 

 

The ____ element is used to link data to the database.

<HTML>
<XML>
<JAVA>
<property>

 

 

Which of the following correctly describes Hibernate Envers?

Facilitates querying historical data
All
Facilitates auditing of all mappings defined by the JPA specification
Facilitates auditing of Hibernate mappings, which extend JPA, like custom types and collections/maps of "simple" types (Strings, Integers, etc.)

 

 

Which one of the following statement is true about the following query: FROM Item AS item WHERE item.description like ? AND item.date > ?

The query indicates that there is a table named item and has columns named as "description" and "date"
The as keyword is optional
The index of binding parameter start from 1 instead of 0
The FROM WHERE AND are HQL keywords and has to be uppercase

 

 

A/an ______ is a primitive data type.

SQL
Variable
Integer
OOP

 

 

Which of the followings might be able to solve N+1 problem?

use LEFT JOIN FETH clause on the HQL
add @Fetch annotation and specify a FetchMode of SUBSELECT
All of these
add @Fetch annotation and specify a FetchMode of JOIN

 

 

The configuration object class is used to create a(n) ____?

ArrayList
SessionFactory
VariableRepository
Rational Database

 

 

Which of the following is TRUE about @GeneratedValue annotation?

Its is used to specify the table to persist the data
It is used to mark this class as an Entity bean
It is used to specify the primary key generation strategy
It is used to specify the identifier property of the entity bean

 

 

Which of the following is correct?

import org.hibernate.SessionFactory;
using arg.hibernate.SessionFactory:
using org.hibernate.SessionFactory;
import org.hibernate.SessionFactory

 

 

The Hibernate framework is stored in (a) _____.

browser
JAR
javascript
XML

 

 

Databases represent data in a ____ format.

delimited
delayed
tabular
reformatted

 

 

A _______ represents a measure of work done in the database.

table
UDF
transaction
sproc

 

 

POJO stands for_____.

Plaine Ole Java Object
Plain Ole Java Object
Plaine Old Java Object
Plain Old Java Object

 

 

Hibernate takes care of mapping Java to the database using ___?

XSLY
xpath
PL-SQL
XML

 

 

Query objects use ____ to retrieve data from the relational database

Java
.Net
HQL
C#

 

 

A persistent framework is a(n) ____ service that stores and gets objects into a database.

OS
ORM
modular
open

 

 

Which of the following statements are true about Hibernate catching:

Hibernate provides 2 levels of caching
The first level caching is provided by the EntityManager
The first level caching is limited to a particular user or request
All of these

 

 

An ORM solution should consist of which of the following functions:

All of these
Performing basic CRUD operations on objects of persistent classes
Specifying mapping metadata
Specifying queries that refer to classes and properties of classes

 

 

SessionFactory is _____.

delayed
lousy
self-orienting
thread safe

 

 

Which of the following is correct?

private (HibernateException e)
catch (HibernateException e)
catch (OOPException e)
try (HibernateException e)

 

 

The reason for Hibernate is because their is a mismatch or impedance between the object model and the ____?

rational database
revised database
relational database
redundant database

 

 

Which is true:

Session.Cloak
Session.Close
Session.Close();
Session.Cloak()

 

 

Which is true:

using org.hibernate.Session;
import org.hibernate.Session;
using arg.hibernate.Session:
import org.hibernate.Session

 

 

Which of the following is TRUE about Hibernate Search?

Hibernate Search works well in clustered mode
Hibernate Search works well in non-clustered mode
Hibernate Search provides synchronous and asynchronous index updates
All

 

 

Which of the following XML elements is true for Hibernate?

<hibernate-tabular>
<hibernate-mapping>
<hibernate-java-java>
<hibernate-hibernate>

 

 

Java is to the business logic as ____ is to the database

vbscript
perl
SQL
javascript

 

 

A database _____ data.

stores
grows
non-persists
tabs

 

 

The createhibernate.cfg.xml is a/an ____ configuration file.

LMX
XXML
MXL
XML

 

 

If Hibernate does not commit the transaction it can _______.

backflip
rollback
zip it up
fallback

 

 

Which of the following shortcomings are addressed by Hibernate Search?

All
The structural mismatch
The API mismatch
The duplication mismatch

 

 

Hibernate is a high performance ORM. ORM stands for?

object real maker
object relational marker
object relational mapping
object redundant marker

 

 

What instructs Hibernate how to map the classes to the database?

XML mapping file
The Declare statement
A variable
xpath mapping file

 

 

Java is a/an _____ language

tough
Object-Oriented
client
javascript

 

 

Which one of the following statements is NOT true about hibernate Session?

Session is Hibernate's interface for persistence-related operations such as storing and retrieving objects
Hibernate can detect changes to the objects and make updates to the database automatically even if changes are made within the same session.
An instance of Session is lightweight and is inexpensive to create and destroy.
Hibernate session has nothing to do with the web-tier HttpSession.

 

 

Which one of the following statements is NOT true about embedded objects?

The Embeddable type can be reused on other types
The @Embedded annotation means the annotated field is embeddable type
The @AttributeOverride annotation defines what type the database uses to save the embeddable field
User @Emebeddable on a class means it's fields and properties will be persistable as part of another entity.

 

 

Which of the following is NOT a valid caching strategy?

Write-only
Read/write
Nonstrict read/write
Read-only

 

 

Which one of the following statements is true about how Hibernate retrieves an object?

When you're using get() method to retrieve an object that doesn't exist in the database, Hibernate will throw an exception
HQL Hibernate Query Language is a full object oriented query language
You cannot retrieve objects using native SQL queries in Hibernate
When you using load() method to retrieve an object that doesn't exist in the database, Hibernate will return null

 

 

Which of the following statement is NOT true?

The load() method returns proxy by default and the data base will not be effected until the invocation of the proxy
The load() method returns null, when the unique id could not found in the database
The load() method throws an exception,when the unique id could not found in the database
The get() method returns null when the unique id is unavailable in the database.

 

 

Object-oriented languages represent data as a ____ of objects

graph
delimited
tabular
array

 

 

Which one of the following statements is NOT true about many to many relationship mapping?

mappedBy element must be included for the bidirectional many to many relationship
The @JoinColumn and @InverseJoinColumns are used to defined the column names of the foreign keys in the join table
The @JoinTable annotation must be defined on the reverse side of the many to many relation ship
The many to may relationship can be both unidirectional or bidirectional

 

 

Which one of the following statements is NOT true about entity lifecycle events?

Hibernate allows you to specify a different named cache region for each query
The query cache must be enabled using a Hibernate property setting:hibernate.cache.use_query_cache true
UpdateTimestampsCache is a special cache region that holds timestamps of the most recent updates to each table
If the timestamp of the most recent update made to the queried table is early than the timestamp of the cached query results, then the cached results are discarded

 

 

Which one of the following statements is true about using annotation to setup Inheritance Models?

The default value of discriminatorType element in @DiscriminatorColumn is DiscriminatorType.INTEGER
the @Inheritance annotation is used on the subclass to setup the inheritance mapping strategy
the name element of @DiscriminatorColumn annotation specify the name of table
the @DiscriminatorValue annotation is used to specify the value in the in the discriminator column in database

 

 

Which of the following is NOT true about Hibernate OGM (still being developed)?

It is expected to be used to interact with all NoSQL solution in all use cases
It reuses Hibernate Core's object life cycle management and (de)hydration engine but persists entities into a key/value store instead of a relational database
It is a persistence engine providing Java Persistence (JPA) support for NoSQL storage solutions
It reuses the Java Persistence Query Language (JP-QL) as an interface to querying stored data

 

 

Which of the following statements is NOT true about mapping one class to multiple tables using annotation?

entities may be mapped across multiple tables by making use of the @SecondaryTable annotation
The @PrimaryKeyJoinColumn annotation specifies the primary key of the primary table
entities may be mapped across multiple tables by making use of the @SecondaryTables annotation
The "table" attribute needs to be defined in the @Column annotation to specify which table the column belongs

 

 

Which of the following is NOT true about First Level Cache?

Hibernate uses this cache by default
it reduces the number of generated SQL queries within a given transaction
It always "associates" with the Session object
It loads objects and make them available to the entire application

 

 

Which one of the following statements is NOT true about using annotation mapping Entity hierarchies?

The @DiscriminatorValue doesn't have default value and must be defined.
The @DiscriminatorColumn is used to defined the named of the column that is used to differentiate subclasses
The root class of the hierarchy needs to be marked by the @Inheritance annotation
The @Inheritance annotation has a "strategy" attribute which can be used to define the inheritance mapping strategy

 

 

Which of the following is not TRUE about StatelessSession interface/implementation in Hibernate Batch?

A stateless session has no persistence context associated with it
A stateless session does not implement a first-level cache
It does not provide many of the higher-level life cycle semantics
Operations performed using a stateless session cascade to associated instances

 

 

Which one of the following statements is NOT true about join strategy (table per subclass)?

It is more is expensive to query subclass when using join strategy
Join strategy is the most efficient way to store data
Join strategy is the most efficient way to insert data
In join strategy every class will have its state mapped to a different table

 

 

Which one of the following statements is NOT true about Hibernate's cascading persistence?

cascade="save-update" is the default setup in hibernate
cascade="all-delete-orphan" is the same as cascade="all" in addition it deletes any persistent instant when it get dereferenced
cascade ="delete" tells Hibernate to navigate the association when performing delete
cascade ="none" tells hibernate to ignore association

 

 

Which of the following statements is true about using cache in Hibernate?

The iterate()method of the Session and Query interfaces is provided to take advantage of second-level cache.
Caching query will have more impact on applications that perform many inserts, deletes or updates.
To enable query cache all it needs is to invoke setCacheable(true) on the query instance.
The query cache cache all the entities properties returned in the query result set

 

 

Which one of the following statements is NOT true about entity lifecycle events

When the SQL for deletion of an entity gets sent to the database, the PostRemove event will get fired and it indicates success of deletion
Firing of a PostPersist event does not indicate that the entity has committed successfully to the database
If the PERSIST cascade option is set on a relationship of an object that is being persisted and the target object is also a new object, the PrePersist event is triggered on the target object.
The PostLoad callback occurs after the data for an entity is read from the database and the entity instance is constructed.

 

 

Their are five mismatches that occur when storing objects in relational database:granularity,inheritance,identity,associations and

navigation
files
data
databases

 

 

Which of the following correctly describes org.hibernate.SQL log category?

Log all JDBC parameters
Log all SQL DDL statements as they are executed
Log the state of all entities
Log all SQL DML statements as they are executed

 

 

Which one of the following statements is NOT true about HQL joins?

An inner join between two entities returns the objects from both entity types that satisfy all the join conditions
Path navigation from one entity is a form of outer join.
Join conditions can be specified implicitly as a result of path navigation.
Join conditions can be specified explicitly by using the 'join' keyword

 

 

Which one of the following statements is true about entity type and value type in Hibernate?

An object of value type always has a primary key value in the database
Value type objects belongs to an entity and is embedded in the table row of owning entity
An Entity type object cannot exist independently and has to bond to another object
An object of Entity type does NOT have its own database identity

 

 

Which one of the following statements is NOT true about using components in Hibernate?

Hibernate component is the lowest level of unit and cannot own other component
Component is the user defined class that is persisted to the table of owning entity
Hibernate support both unidirectional and bidirectional composition
We can declare a component of an entity by using <component> element

 

 

Which one of the following statements is true about joining associations in Hibernate?

When using outer joins, Hibernate will always return a list containing distinct items.
In HQL the LEFT keyword in LEFT JOIN FETCH is optional
When using HQL join queries you have to explicitly specify the join condition using either WHERE or ON clause
HQL provides a fetch join in the FROM clause to lazy load the associated objects

 

 

Which one of the following statements is True about the following query: from Item as I where i.description = :description

the letter I is alias and the "as" keyword must be place in front of the alias
this query is using positional parameter binding
the Item indicates the name of the entity class and it's case sensitive
The query is using native SQL syntax

 

 

Which of the following is NOT a valid id generator class?

identity
sequence
primary
hilo

 

 

Which one of the following statements is NOT true about transient state?

After a persisted instance gets deleted, it'll become a transient instance
objects referred by other transient instances are transient
Objects instantiated using new operator aren't persisted immediately and their state is transient.
Transient instance is always associated with a row in a database

 

 

Which one of the following statements is true about the following HQL query: select department from Department department join department.employees employee where employee.address.state = 'CA' and department.name='marketing'

The department objects returned are lazy loaded.
The query returns a List of Object[] arrays, at index 0 is Department and Index 1 is Employee
The query will return all departments not matter the department has an employee or not
The query is using outer join

 

 

Which one of the following statements is NOT true about the following HQL query: from Item item join item.bids bid where item.description like '%gc%' and bid.amount > 100

The query assigns the alias "item" to the class ITEM and alias "bid" to the Bid class
The query returns all combinations of associated Bids and Items
The query returns a List of Object[] arrays
The bids collection of each Item will be eagerly loaded.

 

 

Which of the following is NOT a valid org.hibernate.ConnectionReleaseMode?

AFTER_TRANSACTION
AFTER_STATEMENT
ON_OPEN
ON_CLOSE

 

 

Which one of the following statement is NOT true about many to one relationship mapping?

The @JoinColumn must be defined with @OneToMany annotation
The @JoinColumn defines the name of the foreign column
If the relationship is bidirectional mappedBy attribute must be defined for the @OneToMany annotation
The @ManyToOne defines a single-valued association to another entity class that has many-to-one multiplicity.

 

 

If you want to save your modifications at any time without knowing about the state of an session, then which of the following operations will you use:

Neither Merge nor Update
Both Merge and Update
Update
Merge

 

 

Which one of the following statement is NOT true about single table inheritance strategy?

The single table strategy uses one table to contain all the possible state of a hierarchy
There shouldn't be any columns left unfilled in the single table strategy
The single table strategy is the most performance way in polymorphic queries and write operations.
Single table strategy will be more wasteful of database space.

 

 

Which of the following is NOT true about Hibernate Template?

It automatically open and close sessions and commit or rollback transactions after the code execution
All Hibernate Template features can be achieved in an aspect-oriented way using Spring's Declarative Transaction Management
They perform common setup routines for you, let you skip the boilerplate and concentrate on the logic you want
Since it decouples the application from the spring framework, it is recommended that HibernateTemplate is always used for integration

 

 

Which of the following statements is True about one to one relationship mapping?

The @JoinColumn annotation goes on the mapping of the entity that is mapped to the table containing the foreign key
One to one mapping can only be bidirectional
mappedBy element should be specified in the @OneToOne annotation in the entity that defines a join column
One to one mapping can only be unidirectional

 

 

Which one of the following statements is NOT true about using annotation to map Compound Primary Key?

The primary key class needs to be marked with @IdClass annotation
The primary key class must include equals() and hashCode() method
Mapping compound primary key requires creating a separate primary key class containing the primary key fields
The primary key class must be private, but it's optional to implement Serializable

 

 

Which of the following is NOT a valid CascadeType value?

PERSIST
DELETE
MERGE
REFRESH

 

 

Which of the following statements is NOT true about persistent instance?

Before session get closed, an object will becomes persistent after it get saved by the persistence manager's save() method.
A persistent instance has a primary key set as its database identifier
Any change made on the persistent object will be synchronized with the database after the transaction ends.
An object is not persistent if it's retrieved from the database by the execution of query.

 

 

Which of the following is NOT true about sharding in Hibernate (Hibernate Shards)?

Hibernate Shards can be conceptually divided into Generalized sharding logic and Application specific sharding logic
Hibernate Shards primarily consists of shard-aware implementations of many of the Hibernate Core interfaces
The primary goal of Hibernate Shards is to enable application developers to query and transact against sharded datasets using the standard Hibernate Core API
Hibernate Shards can be conceptually divided into Generalized sharding logic, Application specific sharding logic and Hibernate Default sharding

 

 

Which of the following is NOT true about SessionFactory?

It helps in customized extraction of data.
Its initialization process is expensive as it loads all configurations including database setting, OR settings
Configures HIBERNATE with HIBERNATE configuration file for use in application
Its a Singleton class

 

 

Which of the following is not a VALID hibernate interceptor event?

SelectEvent
PersistEvent
ReplicateEvent
SaveOrUpdateEvent

 

 

Which one of the following statements is true about the following HQL query: select p.number from employee e join e.phones p

This query is missing the joining condition so it won't work
Because the "phones" is a collection association field, the path navigation couldn't continue
The query indicates that the "number" is the name of one of the columns of the Phone table
This query is using outer join so it'll return all the Phone entity instances no matter it is associated with an Employee or not.

 

 

Which of the following is NOT a valid layer in hibernate framework?

java application layer
hibernate framework layer
backhand API layer
transaction layer

 

 

Which of the following is NOT a valid hibernate performance tuning strategy?

Set ReadOnly to "true" on Queries and Criteria, when objects returned will never be modified
Set FlushMode to "Never" on Queries and Criteria, when flushing is not necessary at this point
Avoid join duplicates
Avoid clearing the whole Session after flushing

No comments:

Post a Comment