I have two tables, both named Language in two different schemas, lets call them schema1 and schema2.
When I annotate the models for each of these tables, my code looks like this:
@Entity
@Table(name=”language”, catalog=”schema1″)
public class Language {
.....................
@Entity
@Table(name="language", catalog="schema2")
public class Language {
But when doing this, I get an annotation Exception error as follows:
org.hibernate.AnnotationException: Use of the same entity name twice: Language
So, does this mean I can’t have identically named tables in two different database schemas or am I just annotating my models wrong?
Thank you,
Elliott
It turns out that the model in schema 2 was an object that was an extension of the model object in schema 1. Hibernate does not like this kind of construction when the two tables are named the same. Making the second object not an extension of the first, eliminated the problem.