In hibernate, You
cannot have two classes with the same name in the same or different
packages else you will get an error at runtime like
"Caused by: org.hibernate.DuplicateMappingException: duplicate import: ....(try using auto-import="false")"
I have resolved this issue by adding property name on the Entity annotation.
Let us suppose I have Meta class in two different packages "com.database.user" and "com.database.group', you can resolve it as :
"Caused by: org.hibernate.DuplicateMappingException: duplicate import: ....(try using auto-import="false")"
I have resolved this issue by adding property name on the Entity annotation.
Let us suppose I have Meta class in two different packages "com.database.user" and "com.database.group', you can resolve it as :
package
com.database.user
@Entity(name=
"com.database.user")
@Table(name="USER_META")
public
class Meta
package
com.database.group
@Entity(name=
"com.database.group")
@Table(name="GROUP_META")
public
class Meta
There
must be some other ways too to resolve this issue, So please feel
free to share it :)
No comments:
Post a Comment