Still wondering if my original problem can be solved...
What if I made a class similar to ResursRelation:
Code:
<class name="ResRelSubQuery" mutable="false">
<subselect>
select t1.c1,t1.c2,t1.c3 .....
from resursrelation t1, resurs t2, resurstyp t3
where t1.resursid1=t2.resursid
and t1.tomtstamp is null
and t2.resurstypid=t3.resurstypid
and t3.beteckning='version'
</subselect>
<id name="c1"/>
<property name="c2" ..../>
....
<sql-insert>
insert into resursrelation (c2,c3,...) values (?,?,...)
</sql-insert>
....
</class>
So that the ResRelSubQuery is really a view of the ResursRelation table (ie. immutable) but inserts/updates may occur via the sql-insert/sql-update tags. Is something like this possible. Or will the subselect force the class to be truely read-only (ie. no inserts/updates allowed).
If I had a ResRelSubQuery class like the above then I could map a set from the Resurs subclasses to permutations of the ResRelSubQuery class and solve the original problem.