Interfaces in Hibernate

There are 5 main Interfaces in Hibernate which form its lifeline. All of them are found in the org.hibernate package. An overview of the hibernate APIs can be found at www.hibernate.org

• Configuration interface

o Used to configure hibernate in any java application
o The java application is provided with a JDBC connection and resource mapping using the Configuration API
o It’s the first object a user uses while working with hibernate

• SessionFactory interface

o This interface is used to obtain session objects
o Though it is thread safe, we need one SessionFactory for each database that the application is connecting to.
o It acts as a kind of Cache storage during runtime giving the database sessions available for java objects.

• Session interface

o This is the primary Interface used by hibernate
o It is known as the hibernate’s persistence manager
o It is the interface used to obtain a transaction.
o It is different from the httpSession object and the two should not be confused.
o Session objects are not thread safe

• Transaction interface

o Though an optional API, it performs the all important task of abstracting the application from the underlying complex JDBC or JTA transaction.
o Each transaction object represents an atomic unit of work.
o Each session may have one or more transactions.

• Criteria and Query interface

o Query interface controls the “how” and “what” of executing queries on a database.
o Queries can be written in native SQL or in hibernate query language
o Criteria queries are those created using Java objects and Criteria interface is useful in helping to create them.

How to create LOV in ADF 11g

Hi,

This week we will be learning how to create LOVs in Oracle ADF application.

Pre-requisites:
– HR Schema in Oracle database.
– I am using Jdeveloper 11.1.3

Objective:
On this post we will create LOV for Department Id in Simple Employee based form.

Steps to follow:

Adding Department Entity:

– Add Departments Entity by Right clicking on Vinay.model package in Model project and choose New Entity Object
Enter Name as ” Department ” and Choose Schema object as ” Department ” by pressing Browse button you can select from the list of objects as well.

Right click on Vinay.model.view package and Choose New View Object name Departments as below


Now we will be creating view object for Department

Uncheck the updatable checkbox.

Select department name and department id.in the order by clause use department ID.
Click next and finish it.Repeat the same step for Employee ViewObject.

Now we will be creating the lov . Double click Departmet view object.
– Select DepartmentId attribute in the attribute page and Click “+” green button at the bottom under List of Values section.

– Click the green + button with List Data Source.
A create List of value wizard will open.In the configuration tab click the + sign if there is no default value is there

On clicking of the ‘+’ sign a view accessor pop up will open.Select Department View Object and shuttle to right side.

In the list attribute select department ID.Click ok.Now your department View object would like as below

Now we will link Lov to the JSPX page.Click new on view controller project.And select jsf page.Give
File name LovPage.In

In the data control palette.Select department view which we created and drag drop on the page

A wizard will open.As you can see department Id is coming as select one choice

Now your jspx page look like this.

Click run on the page. In browser you can see department Id is coming as LOV.It is easy to create.If you want to create lov from another entity object then you need to have accessor on that referring entity object.And you will use that accessor in List Data source in configuration tab.