Reputation: 23
I got this error:
Caused by: org.hibernate.DuplicateMappingException: The [com.KRON.ReportPortal.Model.RPT_BILANCA.Dohvati_BilancaPoOperatorima2] and [com.KRON.ReportPortal.Model.RPT_REPORT_PORTAL.Dohvati_BilancaPoOperatorima2] entities share the same JPA entity name: [Dohvati_BilancaPoOperatorima2] which is not allowed!
when I try to deploye springboot application.
But I dont have model Dohvati_BilancaPoOperatorima2 in my project. Springboot Model structure
Any help please?
Upvotes: 0
Views: 3213
Reputation: 597
the accepted answer is to delete the project and clone it again but it is not required , this problem happens when you delete some project file (or rename) and you have a previous build (target directory), just run this command to fix the issue
mvn clean
or if you are using Intellij IDE and dont have maven installed locally on your system:
./mvnw clean
or you can manually delete the target directory
Upvotes: 0
Reputation: 366
I resolved this by changing the JPA entity name. ie.
@Entity(name="STUDENT_API_APP")
@Table(name="STUDENT")
@Data
public class Student {
// fields
}
Upvotes: 1
Reputation: 11
This happened to me after I built my project on a previous commit. After switching back to the current commit, which had the same class but the package was renamed, I got this error. Building the project again resolved it.
Upvotes: 1
Reputation: 251
This problem happened when I upgraded hibernate from version 5.2.4 to version 5.6.10. While researching the cause of the problem, I found out that it was version bound. Although the entity class names were the same in the previous version, I distinguished them from the table names in the base using the @Table annotation. Example: @Table(name="adm_menu",schema="admin") @Table(name="aas_menu",schema="aas") However, this use was not possible in the new version
Upvotes: 1
Reputation: 165
I was able to resolve the error by manually deleting some generated directories in my Spring project under IntelliJ. I deleted the build
directory, .gradle
directory, and out
directory. After that, I rebuilt the project and the problem disappeared.
Upvotes: 1
Reputation: 36
Check if you have any dependencies in your project that define an entity with the same name. You can try excluding those dependencies from your project or renaming your entity to avoid conflicts.
Upvotes: 1