自己做的一个hibernate的小程序,两个类TLendLog 和TBookMaster 还有它们的配置文件。
然后自己做了一个测试类 test1,里面只有一句话。 程序很简单,但是报 Duplicate collection role mapping错误
弄得我已经郁闷两天了,麻烦高手看一下。
package book.bean;
public class TLendLog implements java.io.Serializable {
private Long userMaster;
private Long bookMaster;
private String updatePerson;
public String getUpdatePerson() {
return updatePerson;
}
public void setUpdatePerson(String updatePerson) {
this.updatePerson = updatePerson;
}
public Long getUserMaster() {
return userMaster;
}
public void setUserMaster(Long userMaster) {
this.userMaster = userMaster;
}
public Long getBookMaster() {
return bookMaster;
}
public void setBookMaster(Long bookMaster) {
this.bookMaster = bookMaster;
}
}
package book.bean;
import java.util.*;
public class TBookMaster implements java.io.Serializable {
private Long bookId;
private String bookTitle;
private Set logs = new HashSet(0);
public Long getBookId() {
return this.bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public String getBookTitle() {
return this.bookTitle;
}
public void setBookTitle(String bookTitle) {
this.bookTitle = bookTitle;
}
public Set getLogs() {
return logs;
}
public void setLogs(Set logs) {
this.logs = logs;
}
}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="book.bean.TBookMaster" table="T_BOOK_MASTER" schema="SCOTT">
<id name="bookId" type="java.lang.Long">
<column name="BOOK_ID" precision="9" scale="0" />
<generator class="assigned" />
</id>
<property name="bookTitle" type="java.lang.String">
<column name="BOOK_TITLE" length="30" not-null="true" />
</property>
<set name="logs" inverse="true">
<key>
<column name="BOOK_ID" not-null="true" />
</key>
<one-to-many class="book.bean.TLengLog" />
</set>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="book.bean.TLendLog" table="T_LEND_LOG" schema="SCOTT">
<id name="userMaster" type="java.lang.Long">
<column name="USER_ID" precision="9" scale="0" />