Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
First Hibernate example run in eclipse tutorial
12-14-2011, 06:25 PM
Post: #1
Photo First Hibernate example run in eclipse tutorial
Today you are going to learn how to use hibernate in eclipse.
Learn more about hibernate by visiting here In order to view links, you must have to reply to this thread.

How to run the example project by us in eclipse

First download the project from here In order to view links, you must have to reply to this thread.
After creating a project In eclipse there is a possibility to add hibernate capabilities by right clicking the project so that all jar files are included.copy all jar files in that project and copy it to the downloaded project folders lib folder.These are the important jar files needed for most of our hibernate projects

ant-1.6.2
ant-antlr-1.6.2
ant-junit-1.6.2
ant-launcher-1.6.2
antlr-2.7.4
ant-swing-1.6.2
c3p0-0.8.5
cglib-full-2.0.2
cleanimports
commons-collections-2.1.1
commons-logging-1.0.4
concurrent-1.3.2
connector
dom4j-1.5.2
ehcache-1.1
hibernate3
jaas
jacc-1_0-fr
jaxen-1.1-beta-4
jboss-cache
jboss-common
jboss-jmx
jboss-remoting
jboss-system
jdbc2_0-stdext
jgroups-2.2.7
jta
junit-3.8.1
log4j-1.2.9
mysql-connector-java-3.0.16-ga-bin
oscache-2.1
proxool-0.8.3

swarmcache-1.0rc2
versioncheck
xerces-2.6.2
xml-apis
Once done Go to file->import->general->existing projects into workspace->next->select root directory where your downloaded files are->it will show hibernates2gateway ->click finish
create or using test database of mysql>use test;

create table two(id integer auto_increment primary key,bname varchar(50));
Insert some values Next in hibernate.cfg file change the dialect if you use any other database,username,password,connection url accordingly.

Quote:<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="s2s.hbm.xml"/>
</session-factory>
</hibernate-configuration>

and finally right click the project and select run as java application and select the classes name for ex "selectexample" or Directly right click the java file and run as java application it will execute the program.
Find all posts by this user
Add Thank You Quote this message in a reply
02-02-2012, 01:42 PM
Post: #2
RE: First Hibernate example run in eclipse tutorial
let's see the content
Find all posts by this user
Add Thank You Quote this message in a reply
02-07-2012, 03:16 AM
Post: #3
RE: First Hibernate example run in eclipse tutorial
thanks
Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies Views: Last Post
Photo How to import a war file in to eclipse rajasri 0 560 12-13-2011 03:32 AM
Last Post: rajasri
Star JSF example application to run in eclipse rajasri 0 355 12-13-2011 12:17 AM
Last Post: rajasri
Photo how to add .properties/.jar file to classpath in eclipse rajasri 0 704 12-12-2011 11:56 PM
Last Post: rajasri

Forum Jump:


User(s) browsing this thread: 1 Guest(s)


WE will share important jobs and updates on facebook so like us to get updates