Sei sulla pagina 1di 4

Hibernate ebooks,Hibernate example,Hibernate examples,Hibernate tuto...

http://r4r.co.in/java/hibernate/

Link This Page To Your Website

Chat

undefined

Right Place For Right Person TM


Home Tutorials Articles Forums SourceCode Books Certifications Interviews

New Updates
JAVA Home

R4R

Java Hibernate Hibernate Basic Tutorials

Hibernate Basic Tutorials Hibernate Interview Questions And Answers Hibernate Objective Questions Hibernate Interview Questions And Answers Hibernate FAQS

R4R provide basic Hibernate Tutorials concept with Hibernate Examples . Through R4R you can develop Hibernate programming concept. R4R provide Hibernate Interview Questions with answers. R4R provide Hibernate Languages study materials in easy way.

Hibernate Tutorials
1.1 Hibernate Basic Tutorials

Hibernate Interview Questions with Answers


2.1 2.2 2.3 2.4 Hibernate Interview Questions And Answers Hibernate Objective Questions Hibernate Interview Questions And Answers Hibernate FAQS
Ads by Google

HIBERNATE
Hibernate is a java package that makes it easy to work with relational database. Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate provides a solution to map database tables to a class. It copies the database data to a class. In the other direction it supports to save objects to the database. In this process the object is transformed to one or more tables. Hibernate solves object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions. The primary feature of hibernate is mapping from java classes to database tables and from java data types to Sql data types. Hibernate generates the SQL calls and attempts to relieve the developer from manual result set handling and object conversion and keep the application portable to all supported SQL databases with little performance overhead. Two terms need to be understand in hibernate is Persistence and Mapping. Persistence: Saving data to a storage is called persistence. Hibernate provides transparent persistence for Plain Old Java Objects (POJOs). persistent class is a no-argument constructor, not public. Persistence frame work:persistence frame work moves the data in its natural form to and from the permanent storage of data i.e. database Hibernate is a powerful, ultra-high performance object/relational persistence and query service for Java. Mapping: Copying of tables to object and objects to table is called object relational mapping. using object relational mapping you can reuse your code. you can separate your dialog from your logic ,and logic from persistence mechanism. Mapping Java classes to database tables is accomplished through the configuration of an XML file or by using Java Annotations. Hibernate supports the mapping of custom value types. which makes the following scenario possible: 1.Mapping a single property to multiple columns 2.Mapping Java Enum to columns as if they were regular properties. 3.Overriding the default SQL type that Hibernate chooses when mapping a column to a property. WHAT IS HIBERNATE QUERY LANGUAGE Hibernate introduced a SQL inspired language called Hibernate Query Language (HQL). ) which allows SQL-like queries to be written against Hibernate's data objects. HIBERNATE INTEGRATE PROGRAMMING LANGUAGES Hibernate can be used both in standalone Java applications and in Java EE applications using servlets or EJB session beans. It can also be included as a feature in other programming languages. HISTORY OF HIBERNATE Hibernate was started in 2001 by Gavin King as an alternative to using EJB2-style entity beans. Its mission back then was to simply offer better persistence capabilities than offered by EJB2 by simplifying the complexities and allowing for missing features. Early in 2003, the Hibernate development team began Hibernate2 releases which offered many significant improvements over the first release and would go on to catapult Hibernate as the "de facto" standard for persistence in Java. The current version of Hibernate is Version 3.x. This version introduced new features like a new Interceptor/Callback architecture, user defined filters, and JDK 5.0 as of 2010 Hibernate 3 (version 3.5.0 and up) is a certified implementation of the Java Persistence API 2.0 specification via a wrapper for the Core module which provides conformity with the JSR.

Java Developer Hibernate Java Java Classes

Ads by Google

Java from C# Java Files Java Tutorial

Ads by Google

Java JBoss Java For Learn Java

1 of 4

10/4/2012 12:14 PM

Hibernate ebooks,Hibernate example,Hibernate examples,Hibernate tuto...

http://r4r.co.in/java/hibernate/

HIBERNATE APIs Hibernate application interface programming are present in the java package org.hibernate. Two interfaces are present in org.hibernate package 1.org.hibernate.SessionFactory interface:-References immutable and threadsafe object creating new Hibernate sessions. Hibernate-based applications are usually designed to make use only of a single instance of the class implementing this interface . 2.org.hibernate.Session interface:-Represents a Hibernate session i.e. the main point of the manipulation performed on the database entities. The latter activities include (among the other things) managing the persistence state (transient, persisted, detached) of the objects, fetching the persisted ones from the database and the management of the transaction demarcation. WHY SHOULD ONE CAN USE HIBERNATE Hibernate provide important features of it that's why it is good to use hibernate. 1.Performance: Hibernate can save your time and efforts, and it can let you achieve some performance gains that you could hardly ever achieve by hand-coding. 2.Portable: Application portability is a key feature in Hibernate it allows developers to port applications to almost all SQL databases. data query and retrieval is possible with hibernate. 3.Set of objects: Hibernate is set of objects we don't need to learn SQL ,here we can treat table as object. In case of JDBC we need to learn SQL . 4.Fast development: Development fast in case of Hibernate because you don't need to write queries. 5.Get benefit of Cache: Hibernate support two level of cache. First level and 2nd level. So you can store your data into Cache for better performance. In case of JDBC you need to implement your java cache . ARCHITECTURE OF HIBERNATE

The above diagram shows that Hibernate is using the database and configure the data to provide persistence services to the application. Hibernate architecture has three important components. 1.Connection management:-Connection management efficiently manage the data of data base. Data base connection is the very expensive part of interacting with the database as it requires a lot of resources of open and close the database connection. 2.Transaction management:-This management service provide the ability to the user to execute more than one database statements at a time. 3.Object relational mapping: Object relational mapping is the technique of mapping the data from object model to the relational data model. This part of management is used to insert data ,update data ,select data, and delete the records from the table. In case of connection management and Transaction management hibernate lacks in performance and capabilities but it is very good tool as far as object relational mapping is concern. HOW HIBERNATE WORKS Hibernate provide tools to generate java classes from the description file. description files from existing data base and data base tables from description files. Hibernate starts from simple java classes (Pojo = Plain Old Java Objects). 1.To use hibernate you will first create a simple java class.

public class Demo implements Serializable { private int hashValue = 0; private java.lang.Integer id; private java.lang.String title; public Demo()

2 of 4

10/4/2012 12:14 PM

Hibernate ebooks,Hibernate example,Hibernate examples,Hibernate tuto...

http://r4r.co.in/java/hibernate/

{ } public Demo(java.lang.Integer fid) { this.setId(fid); } public java.lang.Integer getId() { return id; } public void setId(java.lang.Integer id) { this.id = id; } public java.lang.String getTitle() { return title; } public void setTitle(java.lang.String title) { this.title = title; }

2.Now we create a mapping file. The mapping file explains Hibernate which field in the class is mapped to which field of the database. Mapping is used to insert ,update, select data to the table.

<hibernate-mapping package="r4r"> <class name="Demo" table="Emp"> <id name="id" column="fid" type="java.lang.Integer"> <generator class="sequence"> <param name="sequence">public Demo_fid_seq</param> </generator> </id> <property name="title" column="ftitle" type="java.lang.String" /> </class> </hibernate-mapping> 3.Asclass is created in hibernate ,now we have start using the hibernate class. In this case classDemo and we did entry to the data base as:

Demo demo = new Demo(); demo.setTitle("Title"); demo.setTuserFk(tuser); Transaction tx = session.beginTransaction(); session.save(demo); tx.commit(); we can use MyEclipse to to create the description file. it provide functionality to create classes and description file from the data base directly. HIBERNATE Hibernate is a open source that provide a package to work with relational database. Hibernate is a library called Object Oriented Mapping (ORM) library. which provide a framework for mapping an object oriented model to traditional relational database . The main feature of hibernate is mapping from java classes to database tables and similarly another feature is again mapping of java data types to the Sql data types Hibernate provide the data query and retrieval facilities which helps in development and reduce the development time. Hibernate can be used in java servlets ,swings based applications and J2EE applications along with EJB. HQL HQL is Hibernate Query Language it Sql like query language which allows to write queries against hibernate's data objects . If HQL is used in the application then hibernate automatically generate the SQL query and execute it against the data base. FEATURES OF HIBERNATE Hibernate support full object oriented query language. Hibernate provides a solution to map database tables to a class this is called mapping. Object relational mapping is one of the important feature of hibernate. Hibernate provide a important feature of automatic key generation. i.e. automatic primary key generation. Hibernate reduce the development time because it is totally follow the polymorphism ,inheritance and java collections. ARCHITECTURE OF HIBERNATE To work with hibernate it is necessary to first create a java class which represent the table in a database. The next step is to map the instance variable in the class with the columns in the database. Now the hibernate is ready to perform the task on the database like insert, update ,delete etc. the records in the table. The query is automatically generated by the hibernate to perform these operations. Hibernate has many three components 1.Connection management:-This is one of the service of the hibernate ,it efficiently manage the database connection. 2.Transaction Management:-Another service of hibernate which provide the ability to the user to execute more than one database statement at a time. 3.Object Relational Mapping:-This is a technique of mapping the data from an object model to the relational data babe model. This is the part part of hibernate which is used to update ,insert and delete the records the from the regarding table. Hibernate API Hibernate API is provided in the Java package .org.hibernate .This package defines the central hibernate APIs ADVANTAGES OF HIBERNATE

3 of 4

10/4/2012 12:14 PM

Hibernate ebooks,Hibernate example,Hibernate examples,Hibernate tuto...

http://r4r.co.in/java/hibernate/

1.It takes less 2.Hibernate is 3.Hibernate is 4.Hibernate is

development time. Robust and high in performance. free under the LPGL lisence. so it can be used for develop application and distribute free. database independent. it can be used for any database.

Hibernate Servlet
Hibernate is a java package that makes it easy to work... A Servlet is a Java programming language class ..

J2ME
J2ME was designed and released by Sun Microsystems........

Struts
Struts1.3 Frameworks an.... is a which is

Android JSP
Java server pages (JSP) is based on java... Android is a stack of software for mobile devices...

Spring
Spring Framework is a lightweight ...

JDBC
Java Database connectivity is an software abstraction.......

Advance Java JSP Servlet Struts 1.x Struts 2.x Hibernate 3.x RSS SOAP

Spring 2.x C# Ant EJB ASP .Net ADO .Net DTD E4X

Silverlight WCF WPF Webservices SQL PHP WSDL XLXP

Testing LINUX UNIX HR AJAX JavaScript XLST XPATH

VC++ C HTML DHTML CSS VBScript ASP XQuery

WMLScript WML XML XML Schema HTMLDOM XHTML XFORMS VB

Career || ASK Question || Placement Papers || Interview Question || Mini Project || Aptitude Paper || HR Q&Ans || ContactUS || Post Comments || Read Comments

4 of 4

10/4/2012 12:14 PM

Potrebbero piacerti anche