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.