-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to combine XML mapping with Annotations?
PostPosted: Thu Apr 10, 2008 8:29 pm 
Newbie

Joined: Thu Apr 10, 2008 7:47 pm
Posts: 2
Hi,

In my database, name of tables that my software uses vary on the year which we are working at..

For example:

in 2007, company uses:
TableA_07
TableB_07


in 2008, company creates new tables named as:
TableA_08
TableB_08


Only name varies,
However, if i map my Entity classes as

Code:
@Entity
@Table(name="TableA_07")


My entity classes will not be able to work at 2007, (when using TableA_08).

1) So, i must change TableNames whenever i need. How can i do that with Annotations? If i can not do this only by annotations, is there any way to combine XML mapping with Annotations?

2) Is there anyway out of deploying same ejbs twice for making different users work on different "Year's" tables at same time?

Thanks..


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 10, 2008 9:35 pm 
Beginner
Beginner

Joined: Fri Aug 24, 2007 4:46 am
Posts: 36
Location: Bielefeld / Germany
Did you try to implement and configure a "dynamic" NamingStrategy?

http://www.hibernate.org/hib_docs/v3/re ... ngstrategy

HTH, Maik


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 4:34 am 
Newbie

Joined: Thu Apr 10, 2008 7:47 pm
Posts: 2
So, i must load *.hbm.xml files just for " classname-tablename " mapping and do others with @Annotations?

Hm, what is the answer for my second question? And please any additional answers for my first question... ?

Thanks again..


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.