Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

hibernate mapping question  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everybody,

I am trying to build a standalone application that uses hibernate to connect to a postgres database. I have managed to make it work by using hibernate.cfg.xml and hibernate.hbm.xml to map the classes to the tables. But this is not what I really want. I'd rather use the tag mapping, something like this:

Can anybody pretty please tell me what I have to do to make it work the tag way? Or point to a tutorial?

Thank you in advance,

Corneliu
 
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When using Annotations, it can be done in two ways...

1.) One by using JPA APIs...
2.) Hibernate Specific APIs...

When using Hibernate Specific APIs and using Annotations, You will have to use "AnnotationConfiguration" class and below links would be helpful:

Step-1 :http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html/ch01.html

Step-2 : http://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single/
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey corneliu,
I would suggest JAVA PERSISTENCE with HIBERNATE (by Christian Bauer and Gavin King) is a good reference book to strengthen the basics of Hibernate.
Nice examples and clear understanding of the concepts.
 
corneliu dabija
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Ram Narayan.M: Thank you, all works fine now.
@Bhavesh Dak: Thank you, I hope I won't have to go any deeper than this with hibernate. But if I do I'll get the book.
@everybody: Someone please kill that fly, it's been annoying the moose for too long.
 
Do not threaten THIS beaver! Not even with this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!