-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: how to configure hibernate
PostPosted: Mon Feb 06, 2006 12:29 am 
Newbie

Joined: Mon Feb 06, 2006 12:25 am
Posts: 17
how to configure hibernate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 12:30 am 
Beginner
Beginner

Joined: Thu Jan 12, 2006 7:38 pm
Posts: 25
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 12:33 am 
Beginner
Beginner

Joined: Thu Jan 12, 2006 7:38 pm
Posts: 25
u need to configure your hibernat.cfg.xml also
refer documents...


Top
 Profile  
 
 Post subject: Re: how to configure hibernate
PostPosted: Wed Feb 08, 2006 8:04 am 
Beginner
Beginner

Joined: Mon Jan 30, 2006 2:28 am
Posts: 47
Location: INDIA
Hi bala,

hibernate.cfg.xml is the configuration file name for Hibernate. You need to write connection types and add jar files(for your db oriented) in lib files.

Configuration of Hibernate:

1.You need Hibernate session factory file
2.hibernaet.cfg.xml file (contains mapping files and connections)

eg., hibernate.cfg.xml file look like

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

<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="connection.url">jdbc:jtds:sqlserver://192.168.102.100:1433/ProtoBack</property>
<property name="connection.username">sa</property>
<property name="connection.password">sa</property>

<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>

<property name="show_sql">true</property>
<property name="myeclipse.connection.profile">MyCon</property>

<mapping resource="com/quagnitia/student/Student.hbm.xml" />
<mapping resource="com/quagnitia/student/Admin.hbm.xml" />
</session-factory>
</hibernate-configuration>

in hibernate session factory look like

cfg.configure(CONFIG_FILE_LOCATION);
sessionFactory = cfg.buildSessionFactory();

_________________
A.Edward Durai
"The things which are impossible with men are possible with God."


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 9:42 am 
Newbie

Joined: Tue Oct 25, 2005 12:28 pm
Posts: 18
Location: London
Are you trying to do a simple Hello World? If so, there are tutorials and blogs out there that should you. If you are more specific on here you will get a better response.

To configure Hibernate will take you a couple of days to get going (that was how long it took me) and I am still learning each day.

For a quick reference, I looked at the Developer's Journal, from O'Reilly. For a better and more comprehensive description, the Hibernate in Action book is excellent.

Good luck.

_________________
Cheers,
MikeR


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.