I would like to select a collection of value objects with a hibernate query:
Code:
select myValues from MyEntity e where e=1
But i get this error:
Code:
org.hibernate.QueryException: not an entity [select myValues from eg.MyEntity e where e=1]
How do i select a collection of value objects?
Please help.
Hibernate version: 3.2.6 Mapping documents: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">
<hibernate-mapping package="eg">
<class name="MyEntity">
<!-- primary key -->
<id name="id">
<generator class="native"></generator>
</id>
<!-- simple properties -->
<property name="myProp"></property>
<!-- collection of value objects -->
<bag name="myValues" order-by="name asc">
<key column="myEntity_id"></key>
<composite-element class="ValueClass">
<property name="name" />
<property name="mail" />
</composite-element>
</bag>
</class>
</hibernate-mapping>
Name and version of the database you are using:
mysql 5.0.51