java folder..open it...
u can seee hibernet3.jar file
also u can see lib folder also from extracted folser which contains library file which are want to execute the hibernet.
Now create a new project with eclips.
\right click on project and go properties--->java build path--->Libraries
click on Add Library
select User Library
Next
Again User Library
New
Give a name for New User Library
Dont make a tik for System library
click Ok
Now u can see created Hibernet Library...
Now u wanna add required jars to this library
click on add jars
select jars u wanna add and Ok
hibernet.jar
libraries inside requied folder and lib folder
javaassist.jar
and otehr libries if u want can add
and click Ok
now u can see Hibernet library
tik on the box and Finish..
Now u can see added library in the project explorer
U finish the hibernet configuration.................
(Hibernet internally using JDBC to connect to the database)
if u not using hibernet for saving data ..............................
1. we hv to use JDBC configuration
2.we hv to write model objdriver
3.service method to create a the model object
4.db design
DAO method to save the object using SQL
if u use hb
1.JDBS configuration using by HB configuration file
2.The model object using annotation
3. service method to create a the model object using HB API
4.others no need
------------------------------
create hb config file...
Right click on project and New....>File
Give the name as hibernet.ctg.xml and save it in the src folder of the projects
Open the file..its blank..
write the code for configuration file there..
In ur downloaded file , hv a folder a project..inside this folder hv lots of sample configuration files ...
just open a one and edite a sample config file
give the database details to the xml file
give the dialect class name
Dialect--what kind of languges need to use to writing the SQL queries by the hibernet for accesssing database.
u can find thei from libraries ....
u hv to mention all the entity classes with Name the annotated entity tag
Optianal --------------
u can giv show sql as true., then hb will save all the quires create to, access the database
u can giv the hmb2ddl.auto to create the table if the table is not there it will create the auto.
------------------------------
now create a entity class
HOW TO CREATE A ENTITY CLASS
to mention as a class use Entity --(we telling to Hibernet that this class is a Entity class)
to mention the primary key use Id
create sessionFactory object
then can create sessions from session factory object when database transaction happening
No comments:
Post a Comment