The problem was that I tried tu use another interface instead of an concrete class as my subclass-definition.
But when I did I got a new error...
The mapping :
Code:
<class name="no.song.b2b.clients.OrderProcessDAO" table="ordre_prosess">
<id name="processId" column="prosess_id" unsaved-value="-1">
<generator class="increment" />
</id>
<discriminator column="prosess_type" type="string"/>
<subclass name="no.song.b2b.clients.jara.JaraOrderProcessImpl" discriminator-value="Jara" >
<join table="ordre_prosess_jara">
<key column="prosess_id"/>
<many-to-one name="processId" column="prosess_id" class="no.song.b2b.clients.OrderProcessDAO" update="false" insert="false" />
</join>
</subclass>
</class>
The code :
Code:
OrderProcess prosess = new JaraOrderProcessImpl();
dao.saveOrUpdate(prosess);
The error :
Quote:
org.springframework.orm.hibernate3.HibernateSystemException: instance not of expected entity type: no.song.b2b.clients.OrderProcessDAO; nested exception is org.hibernate.HibernateException: instance not of expected entity type: no.song.b2b.clients.OrderProcessDAO
org.hibernate.HibernateException: instance not of expected entity type: no.song.b2b.clients.OrderProcessDAO
at org.hibernate.persister.entity.BasicEntityPersister.getSubclassEntityPersister(BasicEntityPersister.java:2986)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1089)
The class-structure is like this:
Two 'master interfaces' OrderProcess and OrderProcessDAO, two interfaces extending those : JaraOrderProcess and JaraOrderProcessDAO,
and the class implementing the two latter : JaraOrderProcessImpl.
The concrete class does only implement the master-DAO-interface via inheritance, but shouldn't this be allowed ??