-->
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.  [ 1 post ] 
Author Message
 Post subject: Naming Strategy and annotation conflict
PostPosted: Tue Apr 05, 2011 4:44 am 
Newbie

Joined: Thu Jan 07, 2010 9:58 am
Posts: 4
Hi

I need to "copy" an entity from one table to another to archive it. I wanted to just create a new annotation configuration with a naming strategy, that specifies another database table name to save the entity into. This goes fine except that my entity has a annotation like
@Table(appliesTo = "MyEntity", indexes = { @Index(name="myentity_index", columnNames={"name"}) })
It seems like the annotation "wins" over the naming strategy and thus fails with the following exception:

org.hibernate.AnnotationException: @org.hibernate.annotations.Table references an unknown table: MyEntity
at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:761)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:795)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:546)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1319)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)

I have the database index on the MyEntity database table and dont need it on the archived database table.

I'm using hibernate-core 3.3.1.GA and hibernate-annotations 3.4.0.GA

Am I doing this wrong?
Is there a way to dynamically override this annotation when applying the naming strategy?

Thanks in advance for any input or advice.

Best regards Trym


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

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.