ICS 114 HIBERNATE FINALS

Ace your homework & exams now with Quizwiz!

@Column

To rename a particular field in an Entity class, which annotation will you use?

Java Persistence API

What is JPA?

Object-Relational Mapping is the automated persistence of objects in a Java application to the tables in a relational database. is a programming technique for converting data between relational databases and object oriented programming languages such as Java, C# etc.

What is ORM?

refresh

What is the method name Session.____() that would re-load an object and all its collections

<hibernate-mapping>

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

beginTransaction();

What method in Hibernate can be used to indicate the start of the transaction?

FALSE

A class that is labeled as @Embedabble must also be reflected or indicated in the hibernate.cfg.xml.

@Embeddable

Annotation that defines a class whose instances are stored as an intrinsic part of an owning entity and share the identity of the entity

@Embedded

Annotation that specifies a persistent field or property of an entity whose value is an instance of an embeddable class. The embeddable class must be annotated as Embeddable.

@Lob

Annotation that specifies that a persistent property or field should be persisted as a large object to a database-supported large object type.

FALSE

Combing @Id and @Transient annotations on a particular field attribute in an Entity class is valid.

True

For the Hibernate persistent classes, it must have a default no-argument constructor for your persistent classes and there should be getXXX() (i.e accessor/getter) and setXXX( i.e. mutator/setter) methods for all your persistable instance variables.

SessionFactory.getSession();

How can get a session object?

3

How many types of data in the @Temporal type annotation?

True

The SessionFactory is heavyweight object.

@Transient

The annotation that specifies that the property or field is not persistent.

org.hibernate

The SessionFactory can be found in what package?

FALSE

The name property is valid attribute of the annotation @Transient.

connection.pool_size

The property value in the hibernate.cfg.xml that specifies the number of the pool size in the Connection.

dialect

The property value in the hibernate.cfg.xml that specifies which database type that application uses to connect to a database management system.

Configuration, user, session, query

There are core interfaces are used in just about every Hibernate application. Using these interfaces, you can store and retrieve persistent objects and control transactions. Select all the interfaces that you see

Create tables automatically

What does hibernate.hbm2ddl.auto create this means?

...

Which annotation element of JPA defines maps the unique ID attribute in class to the primary key of the database table?

mapping files/Programmatic configuration XML configuration (hibernate.cfg.xml)

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

DTD, JDBC, SQL, Mapping

Which of the following are tags of hibernate.cfg.xml? Select all that apply

java.util.Date or java.util.Calendar

Which of the following data types can be used to indicate the @Temporal annotation?

You can share the session between threads

Which of the following is FALSE about Session in hibernate?

You must have a default no-argument constructor for your persistent classes and there should be getXXX() (i.e accessor/getter) and setXXX( i.e. mutator/setter) methods for all your persistable instance variables. You should implement the equals() and hashCode() methods based on your business key and it is important not to use the id field in your equals() and hashCode() definition if the id field is a surrogate key (i.e. Hibernate managed identifier). This is because the Hibernate only generates and sets the field when saving the object. It is recommended to implement the Serializable interface. This is potentially useful if you want to migrate around a multi-processor cluster.

Which of the following is NOT a best practice for defining your Hibernate persistent classes?

Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier Wraps a JDBC connection Act as Factory for Transaction

Which of the following is NOT a role of the session interface?

Create HQL Query, Execute query to get list containing Java objects, Load the Hibernate configuration file and create configuration object Get one session from the session factory

Which of the following is NOT a step in the Hibernate communication with RDBMS? Select ALL than Apply (only one doesnt )

Session.remove()

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

JDBC Provider

Which of the following is not a core component of Hibernate?

@Entity annotation marks a class as an entity bean. Class marked with @Entity annotation must have a no-argument constructor that is visible

Which of the following is true about @Entity annotation?

SessionFactory object configures Hibernate for the application using the supplied configuration file. SessionFactory object allows for a Session object to be instantiated. The SessionFactory is a thread safe object. The SessionFactory is heavyweight object. SessionFactory object is created during application start up and kept for later use. You would need one SessionFactory object per database using a separate configuration file.

Which of the following is true about SessionFactory object in hibernate?

A Transaction represents a unit of work with the database. Transactions in Hibernate are handled by an underlying transaction manager. This is an optional object and Hibernate applications may choose not to use this interface, instead managing transactions in their own application code.

Which of the following is true about Transaction object in hibernate?

ORM system lets business code access objects rather than DB tables. ORM system hides details of SQL queries from OO logic. ORM system helps in Transaction management and automatic key generation.

Which of the following is true with respect to ORM vs JDBC?

Detached

__________ objects can be passed across layers all the way up to the presentation layer without having to use any DTOs (Data Transfer Objects). You can later re-attach them to another session


Related study sets

Globális fenntarthatósági kihívások VIZSGA

View Set

Patho 641: Aortic and Mitral Valve Disease (Test 2)

View Set

NCLEX Safety and Infection Control

View Set

Chapter 4 - Covenants, Commitments, & Notices

View Set

Clinical Kinesiology and Anatomy Chapter 5

View Set