• 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

how to map POJOs to table in Hibernate without setting the mapping class or mapping resources in Hib

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

Can any one tell me how to map POJOs to table in Hibernate without setting the mapping class or mapping resources properties in Hibernate.cfg.xml

While learning hibernate, i was asked to map the POJO classes in the hibernate.cfg.xml. When i run the small application without mapping the POJO classes in the hibernate.cfg.xml file, it throws error saying that

Unknown entity: <entire package>.<POJO clas>

But in big applications, i have seen a Hibernate.cfg.xml file where no POJO classes mapping are there. How does big application working fine without mapping the POJO classses in the configuration file.

Regards
Ramki S
 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also use a persistence.xml or annotations on the POJO.
 
Ramki Sukumaran
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi E Armitage,

Can you please explain me this with an example.

Regards
Ramki S
 
Ramki Sukumaran
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How that is done using the persistence.xml. Please any one explain it with an example

Regards
Ramki S
 
reply
    Bookmark Topic Watch Topic
  • New Topic