-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Do Hibernate mapping files override annotations?
PostPosted: Wed Nov 18, 2009 11:35 pm 
Newbie

Joined: Fri Mar 06, 2009 11:22 am
Posts: 16
I read somewhere that EJB3 supports overriding annotations with an XML file, does the same hold true for hbm files and annotations?


Top
 Profile  
 
 Post subject: Re: Do Hibernate mapping files override annotations?
PostPosted: Thu Nov 19, 2009 3:42 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
You can mix annotations and xml. Here is a quote from the API document:
Quote:
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


Precedence decision as per the API doc is as follows
Quote:
To ease the migration process from hbm files to annotations, the configuration mechanism detects the mapping duplication between annotations and hbm files. HBM files are then prioritized over annotated metadata on a class to class basis. You can change the priority using hibernate.mapping.precedence property. The default is hbm, class, changing it to class, hbm will prioritize the annotated classes over hbm files when a conflict occurs.


You may read the complete doc and tutorial in the following URL
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/

_________________
Sukirtha


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.