Abusing the hard-coded positions in sql-insert, I gave this a go and it does exactly what I need:
Code:
<set name="Incrementing" table="IncrValues" cascade="all">
<key column="SetID"/>
<element column="ValIncr" type="integer"/>
<!-- The order and position of the ?s is vital (SetID, ValIncr),
but I want to drop the ValIncr, as that is generated by the DB. -->
<sql-insert>
INSERT INTO IncrValues (SetID) VALUES ( ? ) -- ?
</sql-insert>
</set>
Not especially elegant, but easily understood, I hope. The -- SQL comment causes the ValIncr set by the user to disappear. When I want a new value in the set, I just call
Code:
obj.getIncrementing().add(0);
session.flush();
session().refresh(obj);
and I have my new ValIncr. Now.. can I award myself a credit for solving my own problem?