Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

adding .hb.xml vs .class in configuration

 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys

iam having a doubt that what is the difference between adding a hbm.xml file
vs .class to the configuration object for building the sessionfactory

let me tell you an example

iam having a table named user

Configuration configuration = new Configuration();
configuration.addClass(user.class) ;//statement 1
vs
configuration.addFile("user.hbm.xml") ;// statement 2

what is the difference between statement 1 and statement 2

regards
amir
[ July 04, 2007: Message edited by: Amirtharaj Chinnaraj ]
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

addClass will try to read a mapping from an application resource, using a convention.

Ex.The class foo.bar.Foo is mapped by the file foo/bar/Foo.hbm.xml.
 
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
i will be happy if i get some

more techinical information

regards
amir
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at this Hibernate documentation. Specifically, have a look at Section 3.1 which mentions why the addClass method is considered better for creating a Configuration.
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic