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
|