I faced an exception while using jpa:
"Use of the same entity name twice"
The exception occured due to the existence of two classes with @Entity have the same name
@Entity ( name="BeanName")
The Entity annotation has attribute called name which is the name of the entity ,its default value is the class name
@table( name="tableName")
The table annotation has attribute called name which is the name of the table ,its default value is the entity name ,and if there is no entity name,then the default will be class name
So the problem in this exception that I used @Entity giving the two entities the same name,and there is problem in that because the container uses the entities names to uniquely identify them and therefore the solution is to use @table and make the two enties use the same table name but use different entity name.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment