Term
|
Definition
| It provides a set of rules for a XML file to follow. |
|
|
Term
What are the two types of XMLs? What is the difference? |
|
Definition
Valid – follows a DTD.
Well-Formed – regular XML code, no DTD. |
|
|
Term
|
Definition
|
|
Term
Define the Transient state of a Hibernate object. |
|
Definition
| An object is transient if it has just been instantiated using the new operator, and it is not associated with a Hibernate session. |
|
|
Term
Define the Persistent state of a Hibernate object. |
|
Definition
| A persistent instance has a representation in the database and an identifier value. |
|
|
Term
Define the Detached state of a Hibernate object. |
|
Definition
| A detached instance is an object that has been persistent, but its session has been closed. |
|
|
Term
In Hibernate, what two methods make an object persistent? What is the difference? |
|
Definition
persist() - makes a transient instance persistent.
save() - guarantee to return an identifier. |
|
|
Term
What are the six features of Hibernate? |
|
Definition
1. Has comprehensive API, support for CRUD operation.
2. No complex queries.
3. Caching support.
4. Criteria API support for retrieving data.
5. Has own Query language (HQL) & also supports native SQL.
6. Lazy loading/fetching. |
|
|
Term
|
Definition
| A temporary object that holds data before it is obtained from the database. |
|
|
Term
How do you query a database in Hibernate?
(Hint: 3) |
|
Definition
- Hibernate's main methods.
- HQL.
- Criteria API. |
|
|
Term
What is first-level caching? |
|
Definition
| It is caching that always associates with the Session object. Used by default, it processes one transaction after another. |
|
|
Term
What is second-level caching? |
|
Definition
| It is caching that always associates with the Session Factory object. It loads the objects at the Session Factory level so the object will be available to the entire application. |
|
|
Term
|
Definition
| A primary key of another table. |
|
|
Term
What are the core interfaces of Hibernate?
(Hint: 6) |
|
Definition
SessionFactory, Session, Configuration, Criteria, Query, Transaction. |
|
|
Term
What are the four relationships between tables? |
|
Definition
| One to One, One to Many, Many to One, Many to Many. |
|
|
Term
|
Definition
| A relationship between tables. |
|
|
Term
What are the two types of Associations? |
|
Definition
| Aggregation and Composition |
|
|
Term
| Define the Association type Aggregation. |
|
Definition
A weak form of association, it is where a child table can still exist even if the parent table is deleted.
|
|
|
Term
| Define the Association type Composition |
|
Definition
| It is a strong type of association, it is where a child table is completely dependant on a parent table. If the parent table deletes all, the child table will be deleted. |
|
|
Term
| How does a application obtain a Session interface? |
|
Definition
| Session session = SessionFactory.openSession(); |
|
|
Term
| When is the Hibernate proxy used? |
|
Definition
| When calling session.load(). |
|
|
Term
| Give an example of a HQl. |
|
Definition
|
|
Term
|
Definition
| When loading the parent entity, the child entity will only be loaded when you request it. |
|
|
Term
What are some minor level annotations?
(Hint: 4) |
|
Definition
| @Temporal, @JoinColumn, @SequenceGenerator, @Cache. |
|
|
Term
How do you enable second level caching?
(Hint: 2) |
|
Definition
- In hibernate.cfg.xml, inform it that you are using 2nd level caching and specify why provider you are using.
- In hbm.xml, configure entities and collections to be cached. |
|
|
Term
| What does a instance of the Configuration interface do? |
|
Definition
| It allows the application to specify properties and mapping documents to be used when creating a SessionFactory. |
|
|
Term
| What is the Query interface? |
|
Definition
| It is an object-oriented representation of a Hibernate query. |
|
|
Term
| What does the Transaction interface do? |
|
Definition
It allows the application to define units of work, while maintaining abstraction from the transaction implementation.
If one step fails, the whole transaction fails. |
|
|
Term
|
Definition
| It stores data already loaded from the database, so that traffic between the application and the database will be reduced. |
|
|
Term
Where are named SQL Queries found? |
|
Definition
Named SQL queries are defined in the mapping xml document and called whenever required.
|
|
|
Term
|
Definition
| After an operation (save, update, delete) is performed on an entity, it specifics what operations to perform on relational entities. |
|
|
Term
|
Definition
| Indicates which end of a relationship should be ignored. |
|
|
Term
|
Definition
| It should be used if you want to save your modifications at any time without knowing the state of a session. |
|
|
Term
| When do you use update()? |
|
Definition
| It should be used to save the data when the session does not contain an already persistent instance with the same identifier. |
|
|
Term
| How does a sorting collection work? |
|
Definition
It sorts a collection by utilizing the sorting features provided by the Java collections framework. |
|
|
Term
| How does a order collection work? |
|
Definition
| By sorting a collection by specifying the order-by clause when retrieved. |
|
|