working with persistence unit
I've got a persistence error message about duplicate mapping exception
I've try to debug, but still come to dead end
Hope here I can get some insight
here is my pojo class Code:
package xyzproject.model.business;
import xyzproject.model.AbstractPersistentClass;
public class Module extends AbstractPersistentClass {
private static final long serialVersionUID = 1L;
String name;
String description;
String uiName;
String entityName;
boolean uiActive;
String iconPath;
String status;
int viewOrder;
public Module() {
super();
}
public Module(String name) {
super();
this.name = name;
}
public Module(String name, String entityName) {
super();
this.name = name;
this.uiName = name;
this.entityName = entityName;
}
public Module(String name, String description, String uiName,
String entityName, boolean uiActive, String iconPath,
String status, int viewOrder) {
super();
this.name = name;
this.description = description;
this.uiName = uiName;
this.entityName = entityName;
this.uiActive = uiActive;
this.iconPath = iconPath;
this.status = status;
this.viewOrder = viewOrder;
}
public String getDescription() {
return description;
}
public boolean isUiActive(){
return uiActive;
}
public String getIconPath() {
if (iconPath == null)
return "/modules/" + name + "/view/" + name + ".jpg";
return iconPath;
}
public String getName() {
return name;
}
public String getStatus() {
return status;
}
public String getUiName() {
return uiName;
}
public int getViewOrder() {
return viewOrder;
}
public void setDescription(String description) {
this.description = description;
}
public void setIconPath(String iconPath) {
this.iconPath = iconPath;
}
public void setName(String name) {
this.name = name;
}
public void setStatus(String status) {
this.status = status;
}
public void setUiActive(boolean uiActive) {
this.uiActive = uiActive;
}
public void setUiName(String uiName) {
this.uiName = uiName;
}
public void setViewOrder(int viewOrder) {
this.viewOrder = viewOrder;
}
public String getEntityName() {
return entityName;
}
public void setEntityName(String entityName) {
this.entityName = entityName;
}
}
abstractpersistenceclass just abstract class that define the Id( common field and implements Serialilize )
and it's mapping hbm.xml file Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 19 Jan 10 11:48:51 by Hibernate Tools 3.2.5.Beta -->
<hibernate-mapping>
<class name="xyzproject.model.business.Module"
entity-name="Module"
table="modules">
<id type="long" column="module_id">
<generator class="native"/>
</id>
<property name="name" type="string" unique="true" not-null="true" length="25">
<column name="module_name"/>
</property>
<property name="description" type="string" >
<column name="module_description"/>
</property>
<property name="uiName" type="string" >
<column name="module_uiName"/>
</property>
<property name="entityName" type="string" unique="true">
<column name="module_class"/>
</property>
<property name="uiActive" type="boolean" >
<column name="module_uiactive"/>
</property>
<property name="iconPath" type="string" >
<column name="module_icon"/>
</property>
<property name="status" type="string">
<column name="module_status"/>
</property>
<property name="viewOrder" type="integer" unique="true">
<column name="module_uiOrder"/>
</property>
</class>
</hibernate-mapping>
my hibernate config cfg.xmlCode:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="xyzprojectSessionFactory">
<!- some connection definitions -->
<property name="hibernate.hbm2ddl.auto">none</property>
<property name="auto-import">false</property>
<property name="hibernate.generate_statistics">true</property>
<property name="hibernate.archive.autodetection"></property>
<property name="hibernate.ejb.autodetection">hbm</property>
<!-- and I've commented these imports, but the exception persist -->
<!--
<mapping resource="xyzproject/model/entity/Address.hbm.xml" />
<mapping resource="xyzproject/model/entity/Company.hbm.xml" />
<mapping resource="xyzproject/model/entity/Consultant.hbm.xml" />
<mapping resource="xyzproject/model/entity/Contact.hbm.xml" />
<mapping resource="xyzproject/model/entity/Department.hbm.xml" />
<mapping resource="xyzproject/model/entity/Employee.hbm.xml" />
<mapping resource="xyzproject/model/entity/Project.hbm.xml" />
<mapping resource="xyzproject/model/entity/Task.hbm.xml" />
<mapping resource="xyzproject/model/business/AccessControlList.hbm.xml" />
<mapping resource="xyzproject/model/business/AuditTrail.hbm.xml" />
<mapping resource="xyzproject/model/business/Module.hbm.xml" />
<mapping resource="xyzproject/model/business/Role.hbm.xml" />
<mapping resource="xyzproject/model/business/Session.hbm.xml" />
<mapping resource="xyzproject/model/business/User.hbm.xml" />
-->
</session-factory>
</hibernate-configuration>
does anyone here can show me where I've gone wrong ???