我有一个奇怪的错误与Hibernate3的位置:休眠:为什么@OneToMany与列表<MyClass>失败?
得到了SoftwareDescription类,有以下字段注释掉的作品就好了坚持它:
@OneToMany
@JoinColumn(name = "id")
private List<SoftwarePrice> prices = new ArrayList<SoftwarePrice>();
得到了这一领域的getter和setter。当我尝试坚持一个SoftwareDescription,我得到这个错误:
"Use of @OneToMany or @ManyToMany targeting an unmapped class: de.abelssoft.domain.SoftwareDescription.prices[de.abelssoft.domain.SoftwarePrice]"
这是我SoftwarePrice - 类:
package de.abelssoft.domain;
//...imports...
@Entity
public class SoftwarePrice implements Serializable{
private static final long serialVersionUID = 8771685731600495299L;
public SoftwarePrice(){}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Lob
private Currency currency = null;
private SoftwareLicenses license = null;
private double price = 0.0;
//... setters getters...
}
这是我的Hibernate的配置文件:
<?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="MyHibernateSessionFactory">
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="current_session_context_class">thread</property>
<property name="show_sql">false</property>
<property name="hbm2ddl.auto">update</property>
<mapping class="de.abelssoft.domain.SoftwareDescription" />
<mapping class="de.abelssoft.domain.SoftwareCategory" />
<mapping class="de.abelssoft.domain.SoftwarePrice" />
<mapping class="de.abelssoft.domain.SoftwareDescriptionText" />
</session-factory>
</hibernate-configuration>
能
人解释我在这里没有看到什么?
Uhm。好主意,忘了提,但这只是一个枚举。我在SoftwareDescription.class中获得了该字段,该字段保持得很好,并且还针对枚举: private de.abelssoft.domain.SoftwareArchives softwareArchive; – Akku 2010-02-03 13:53:17