Sunteți pe pagina 1din 5

"Is this configuration correct in hibernate?

<property name = ""abcd"" column=""abcd"" type=""string"" length= ""200"">


<property name = ""abcd"" column=""dcba"" type=""string"" length= ""500"">"

A. Yes
B. None of the above
C. No

A mapping file in hibernate for class ‘Trainee’ is generally named as :

A. Trainee.cfg.xml
B. Trainee.xml
C. Trainee.hbm.xml
D. Trainee.hbm

An object emp can be saved to database using method save(emp) of following :

A. SessionFactory
B. Transaction
C. Session
D. Configuration

After the persistent context is closed the entity goes in the following state

A. Removed
B. Persistent
C. Transient
D. Detached

Choose incorrect sentence

A. Transaction is a set of database operations which must be executed in entirely or not at all
B. All communication with a database has to occur inside a transaction
C. Transaction cannot rollback
D. Transaction should and either with a commit or a rollback

hibernate.cfg.xml is used for

A. Is a generated file at runtime


B. Building the mapping between class and table
C. No such file is required for hibernate
D. Contains the configuration like database details

Hibernate configuration is managed by

A. org.hibernate.Transaction
B. org.hibernate.Session
C. org.hibernate.cfg.Configuration
D. org.hibernate.SessionFactory

Hibernate provides following types of configurations

A. Criteria
B. Transaction
C. Hibernate Query Language
D. hibernate.properties & programatic configuration
Hibernate Query Language

A. Uses class name instead of table name, and property names instead of column name
B. Is native SQL
C. Is JPA Query language
D. Is naming query language

How can get a session object ?

A. SessionFactory.getSession();
B. SessionFactory.openSession();
C. SessionFactory.get();
D. SessionFactory.getObject();

How do you map Java Objects with Database table?


A. Anotation
B. Both
C. XML mapping hbm.xml

How to begin a unit of work and return the associated Transaction object

A. Session.openTransaction()
B. SessionFactory.openTransaction()
C. SessionFactory.beginTransaction()
D. Session.beginTransaction()

Identifier of an entity is denoted by

A. @Id
B. @Key
C. @PrimaryKey
D. @Identifier

If the property of a class should not take part in persistence mechanism than the property should be marked as

A. @Lob
B. @Transient
C. @Temporary
D. @Enum

Java type ‘String’ is mapped to following SQL type in hibernate :

A. VARBINARY
B. CLOB
C. CHAR
D. VARCHAR

Load child object automatically when parent object is loaded?

A. lazy=no
B. lazy=true
C. lazy=fasle
D. lazy=yes
Mapping Java classes to database tables is accomplished through the configuration file

A. Properties
B. Xml
C. Xhtml
D. Html

Once hibernate creates a table for an Object we cannot add a property to the class for saving again

A. Always True
B. True if property size is small
C. Always False
D. None of above

ORM stands for

A. Object Relational Mapping


B. Over related Mapping
C. Object Relational Matching
D. Over related Matching

The <generator> tag is used for :

A. Generating column automatically


B. Generating table automatically
C. Mapping property to column in table
D. Generating primary key values

The delete() method in Session does the following :

A. Removes instance from memory


B. Removes table from db
C. Removes a persistent instance from db
D. None of above

To obtain a SessionFactory with custom config file, we can use the following :

A. new Configuration("mycfg.cfg.xml").buildSessionFactory()
B. new Configuration().configure().buildSessionFactory()
C. new Configuration().configure("myfile.cfg.xml").buildSessionFactory()
D. new Configuration("mycfg.cfg").buildSessionFactory()

Using Criteria Query to

A. Delete object
B. Insert Object
C. Update object
D. Query that are built up using lots of conditional logic, avoid messy string manipulation

What are the main advantages of ORM like hibernate?

A. Support multi databases


B. Support for Query Language
C. Steep learning curve
D. Mapping Java class to table
What does hibernate.hbm2ddl.auto create this means?

A. Create SessionFactory object automatically


B. Create tables automatically
C. None
D. Create session object automatically

What does session.createCriteria().uniqueResult() return?

A. ResultSet
B. String
C. Object
D. HibernateResultSet

What happens when both hibernate.properties and hibernate.cfg.xml are in the classpath?

A. The settings of the properties file will override the settings used in the XML configuration
B. DuplicateConfigurationException
C. The settings of the XML configuration file will override the settings used in the properties
D. None

What is the root level element in a hibernate mapping file?

A. <hibernate-mapping>
B. <session-mapping>
C. <sessionfactory-mapping>
D. None of the above
What is true for session.get() method?

A. Will throw exception if there is no data in db or cache


B. Will return null if there is no data in db or cache.
C. None of the above
D. May return a lazily initiliazed proxy
What was Hibernate written in?
A. Java
B. Ruby
C. C
D. Assembly language

When several entities points to the target entity, that is achieved by?

A. @OneToOne
B. @ManyToOne
C. @ManyToMany

Which annotation is used to achieve optimistic locking in hibernate?

A. @Version
B. @Lock
C. @Release
D. @V
Which interface are not the core interfaces of Hibernate framework?

A. Configuration interface
B. Session interface
C. User Interface
D. Query and Criteria interfaces
E. SessionFactory interface

Which of following is NOT a property in hibernate.cfg.xml file?

A. None of above
B. oracle_dialect
C. connection.username
D. connection.url

Which of following is NOT an annotation used with a class in hibernate?

A. @Entity
B. @Column
C. @Table
D. None of the above

Which of the following are most common configuration methods of Hibernate Configuation?

A. http.conf
B. persistence.xml
C. hibernate.cfg.xml

Which of the following is a tag NOT used in hibernate.cfg.xml ?

A. <property>
B. <session-factory>
C. <hbm2ddl.auto>
D. <mapping>

Which of the following is not a Session method? Select ONE

A. Session.save()
B. Session.load()
C. Session.persist()
D. Session.saveorupdate()
E. Session.remove()

Which of the following is NOT a step in the Hibernate communication with RDBMS?

A. Create HQL Query


B. Create session from configuration object
C. Get one session from the session factory
D. Execute query to get list containing Java objects
E. Load the Hibernate configuration file and create configuration object

Which property are used to configure diver class in hibernate? (Multi-choose)

A. getParameters("name");
B. getParameterValues("name");
C. hibernate.connection.datasource
D. hibernate.connection.driver_class

S-ar putea să vă placă și