Duplicate mapping error: org.hibernate.DuplicateMappingExceptionn

3

I'm using Hibernate 5 and am having the following problem:

Caused by: org.hibernate.DuplicateMappingException: duplicate import: br.edu.unifeob.entidades.apuracao.Avaliacao refers to both br.edu.unifeob.entidades.apuracao.Avaliacao and br.edu.unifeob.entidades.apuracao.Serie (try using auto-import="false")
at org.hibernate.cfg.Configuration$MappingsImpl.addImport(Configuration.java:2892)
at org.hibernate.cfg.annotations.EntityBinder.bindEntity(EntityBinder.java:401)

I have tried to annotate my entities this way but it did not work:

@Entity(name="br.edu.unifeob.entidades.apuracao.Avaliacao")
@Table(name="Avaliacao")
public class Avaliacao {
...
}

@Entity(name="br.edu.unifeob.entidades.base.Avaliacao")
@Table(name="Avaliacao")
public class Avaliacao{
...
}

The two classes are in different persistence units. Does anyone know what can it be? I have already researched and the only way I found to solve the problem is to use the @Entity annotation name to differentiate entities.

    
asked by anonymous 14.08.2015 / 14:22

1 answer

0

Will one of these entities be used only as a read? Home If so, you can include the @Immutable in this entity:

@Entity
@Table(name="Avaliacao")
public class Avaliacao {
...
}

@Entity
@Table(name="Avaliacao")
@Immutable
public class Avaliacao {
...
}

As an example here:

a>

    
05.12.2016 / 14:34