Hi there,
is there a cheap way to map a many-to-many relationship as a list?
I've got a table like this:
ID | POSITION | VALUE
And there is a many-to-many relationship to this table. As a set this works fine, but now I want to make it as a list, thats sorted by POSITION.
If I make it like this:
<list name="customerCards" table="BR_CUST_CARD_X_SMD">
<key column="ID" />
<list-index column="POSITION" base="1" />
<many-to-many column="BCC_GCC_ID"
class="de.ethalon.AnyClass" />
</list>
Hibernate tells me:
org.hibernate.HibernateException: Missing column: POSITION
at org.hibernate.mapping.Table.validateColumns(Table.java:212)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:965)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:297)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at de.ethalon.priamos.data.SessionFactoryTool.getSessionFactory(SessionFactoryTool.java:130)
at de.ethalon.test.TestBranch.main(TestBranch.java:34)
Can anybody tell me, how to map this right? Is it possible?
Bye Michael
|