• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hibernate with struts

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks both of you(pascal betz and Amirtharaj Chinnaraj)
for your answers.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic