@OrderColumn works but <order-column> does not (if used inside an
<element-collection>)
------------------------------------------------------------------------------------------
Key: HHH-6180
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6180
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.0
Environment: We have tested this problem with the following ivy.xml
configuration: <dependency org="org.hibernate"
name="hibernate-entitymanager" rev="3.6.0.Final"/>
We have tested with an H2 Database: <dependency org="com.h2database"
name="h2" rev="1.2.143" />
Reporter: Markus Müller
Priority: Minor
We use the following entity-mapping
{code:xml}
<entity name="EX_Person" class="mapping.embedded.xml.EX_Person"
access="FIELD">
<attributes>
<id name="id"> <generated-value
strategy="TABLE"/> </id>
<element-collection name="hobbies" >
<order-column name="hobbies_ORDER"/>
</element-collection>
</attributes>
</entity>
{code}
with this implementing class:
{code:title=EX_Person.java|borderStyle=solid}
package mapping.embedded.xml;
import java.util.LinkedList;
import java.util.List;
import javax.persistence.OrderColumn;
public class EX_Person {
public EX_Person() { this(0); }
public EX_Person(int persNo) {
this.persNo = persNo;
hobbies = new LinkedList<String>();
hobbies.add("swimming");
hobbies.add("fishing");
}
long id;
int persNo;
// @OrderColumn
List<String> hobbies;
}
{code}
Our problem is that the order column "hobbies_ORDER" of table
"EX_Person_hobbies" is not created on startup.
We use hibernate.hbm2ddl.auto=create to create all tables at startup.
As soon as we uncomment the annotation @OrderColumn all is working fine,
the table "EX_Person_hobbies" gets the column "hobbies_ORDER" to store
the index of the hobbies in the list.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira