This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Mixing Hibernate Annotations with .hbm files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Mixing Hibernate Annotations with .hbm files" Watch "Mixing Hibernate Annotations with .hbm files" New topic
Author

Mixing Hibernate Annotations with .hbm files

Bal Krishna Gupta
Greenhorn

Joined: Apr 02, 2007
Posts: 3
Hi Friends,
Can we mix the hibernate annotations and .hbm files approach?

In my project we were using .hbm mapping file to map the entity objects. When I came to know about Hibernate annotations then I tried to implement hibernate annotations for the further developement but it is showing error that
"Can not fetch simultaneous bags"

Can anyone help me out as I am not able to resolve this problem.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Indeed, you can conbine the use of the AnnotationConfiguration object and mapping files. Here's a quote from the Hibernate documentation:


Note that you can mix the hbm.xml use and the new annotation one. The resource element can be either an hbm file or an EJB3 XML deployment descriptor. The distinction is transparent for your configuration process.

Alternatively, you can define the annotated classes and packages using the programmatic API


Miixing JPA Annotations and Hibernate Mapping Files in the Same Java Project Tutorial

What is the exact error you're getting? Can we see a trace?

-Cameron McKenzie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mixing Hibernate Annotations with .hbm files
 
Similar Threads
Query on MiddleGen ..hbm2java task
confused with JAP,Hibernate
Hibernate Named Queries when using POJO Annotation classes
List, Bag and Set in JPA
Why POJO was not used before