Note that there are some explanatory texts on larger screens.

plurals
  1. POHibernate: Why @OneToMany with List<MyClass> fails?
    primarykey
    data
    text
    <p>I have a strange error with Hibernate3 here:</p> <p>Got a SoftwareDescription class, persisting it with the following field commented out works just fine:</p> <pre><code>@OneToMany @JoinColumn(name = "id") private List&lt;SoftwarePrice&gt; prices = new ArrayList&lt;SoftwarePrice&gt;(); </code></pre> <p>Got getters and setters for this field. When I try to persist a SoftwareDescription, I get this error:</p> <pre><code>"Use of @OneToMany or @ManyToMany targeting an unmapped class: de.abelssoft.domain.SoftwareDescription.prices[de.abelssoft.domain.SoftwarePrice]" </code></pre> <p>This is my SoftwarePrice - Class:</p> <pre><code>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... } </code></pre> <p>This is my Hibernate Config file:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; &lt;hibernate-configuration&gt; &lt;session-factory name="MyHibernateSessionFactory"&gt; &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt; &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/test&lt;/property&gt; &lt;property name="hibernate.connection.password"&gt;root&lt;/property&gt; &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt; &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt; &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt; &lt;property name="show_sql"&gt;false&lt;/property&gt; &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt; &lt;mapping class="de.abelssoft.domain.SoftwareDescription" /&gt; &lt;mapping class="de.abelssoft.domain.SoftwareCategory" /&gt; &lt;mapping class="de.abelssoft.domain.SoftwarePrice" /&gt; &lt;mapping class="de.abelssoft.domain.SoftwareDescriptionText" /&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre> <p>Can anyone explain what I'm not seeing here?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload