-->
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.  [ 6 posts ] 
Author Message
 Post subject: Simply adding hibernate to my spring app
PostPosted: Fri Sep 22, 2006 8:38 pm 
Beginner
Beginner

Joined: Mon Sep 18, 2006 5:33 am
Posts: 25
Hi all,

After looking at various tutorials im still a bit confused on how to add hibernate to my spring app.

My spring app is very simple, i just have a simple form - which i now need to store in a database table.

-I have a simple jsp file as the view
- controller
- a bean which holds the form info
- and a validator.

All the configuration is done in the myapp-servlet.xml file which is referenced in my web.xml file. And i use a simple ant script to run my app.

Since im trying to add hibernate persistance to my app, ive done the following:

-created a myform.hbm.xml file which maps each form field to a table coloum.
-made a hibernate.cfg.xml file which has all the db info and references the myform.hbm.xml file
-created a dao which has simple get and setters

Is this right - what else do i need to do now?

Here is where im stuck, where do i call the doa so all the form information is stored in the table, in the bean i mentioned in the spring app? or make a new class for that. Also what other configuration does my app need to work?

Thanks for any help :)


Top
 Profile  
 
 Post subject: hibernate setting
PostPosted: Sat Sep 23, 2006 3:36 am 
Newbie

Joined: Thu Sep 07, 2006 2:25 am
Posts: 3
Location: mumbai
hi,
ur .hbm.xml file save where is ur persitance classes are avaiable like in dao folder and paste ur hibernate.cfg file in classes folder or ur application if ur using the tomcat as a server.
i think it will solve ur problem
reagrds,
nitin


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 23, 2006 7:15 am 
Beginner
Beginner

Joined: Mon Sep 18, 2006 5:33 am
Posts: 25
hmm ok, but does someone know if i call the dao in the form bean or another bean, ie. a formbeanmanager


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 25, 2006 1:04 am 
Beginner
Beginner

Joined: Mon Sep 18, 2006 5:33 am
Posts: 25
Could someone recommend some books that show how to integrate hibernate with a spring app. Ive got Agile Java Development With Spring, Hibernate and Eclipse - but that doesnt really cover the integration of hibernate in spring very well.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 25, 2006 4:17 am 
Beginner
Beginner

Joined: Thu Aug 24, 2006 6:01 am
Posts: 49
Location: sophia-antipolis, France
spring in action covers hibernate + spring and I have found it quite useful. Spring's integration with Hibernate is so good, I've never used one without the other. In fact, I don't know how to use Hibernate without Spring.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 25, 2006 6:24 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Quote:
Spring's integration with Hibernate is so good, I've never used one without the other.


That might have been true in the old days with Hibernate 2, now it's just not true.

Quote:
In fact, I don't know how to use Hibernate without Spring.


You know, it's a lot less code without it. But then you seem happy.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.