Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate with struts

 
sure nandu
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai everybody,


iam a bit new to hibernates. so i did a simple application using hibernates in struts framework. i had not mentioned any plugin in struts-config.xml. but the application was working fine. iam very confused that how did the struts came to know about the location of
my hibernate.cfg.xml and mapping.hbm.xml. but both files was set in my classpath. if anyone knows please inform. thanks in advance.
 
naga ravipati
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also new to hibernate.I ran one sample application.But it failed .Please send your sample code to me.My mail id is nageswara.ravipati@tcs.com
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"surenandu surenandu"

Welcome to JavaRanch!

Ca you please update you display name so it matches our Naming Policy? You can do this here.

Thanks!
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well surenandu

struts is a framework that takes care of only the VIEW component

it never bother about your Entity(ORM) or BUSINESS it is just a delegate

to request hibernate.jar will search for

this hmb.xml and cfg.xml and create a session for you to Acess

the Databse
 
sure nandu
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks amritharaj for your reply.

can you please eloborate for your answer?
that is when exactly is those files( hibernate.cfg.xml and mapping.hbm.xml)
gets called. or in other words can you tell me when does it get called--->
1) while creating SessionFactory.
2)while creating Session.
3) while beggining transaction.

or which class in hibernate.jar will call those files.
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hibernate.cfg.xml is read when you create the Configuration object.
It is found on the classpath, that is why you did not need to specify the exact location.

Pascal
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well nandu

you have to make a configuration for creating a sessionFactory

this configuration object will read all your xml files

and configures to the sessionfactory from session factory you create

a session to acess the database

regards
amir
 
sure nandu
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks both of you(pascal betz and Amirtharaj Chinnaraj)
for your answers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic