Okay, that works fine.
Separately, I have an affiliation object mapped as follows:
Code:
<class name="HibernateExAffiliation" table="userjobs">
<id column="ujid" name="affId" type="int">
<generator class="identity" />
</id>
<many-to-one name="user" column="usernum" class="HibernateExUser" />
<many-to-one name="job" column="jobid" class="HibernateExJob" />
<set name="accesses" table="user_disc">
<key column="ujid" />
<element column="disc_id" type="java.lang.String" />
</set>
</class>
If I set the set "accesses" with inverse="true", the accesses will be read-only and not updated in the database even if they are in memory, correct? I will say I didn't think so, originally, but my attempts to prove my thoughts were fruitless.
Now, let's assume again here I wish to add a temporary access (or delete one) to an affiliation object, say until the user confirms that the change should be made. In order to have a confirmation UI, I must generate a copy of the retrieved affiliation, manipulate/display that version, and then save it to the session (using one "Long Session")? Optionally, I can use two sessions, destroying the original session after retrieval, modifying the retrieved object, opening a new session, and updating it with the original object (which has been altered), right?
And this works fine as long as I don't evict the parent from the cache. Doing so causes all the children (accesses) to be deleted from the database. Is there a way to evict an ENTIRE object, or do I somehow have to evict an objects children, then the object (or does that cause deltion problems, as well)?
Most of the examples I saw in the documentation refered to <many-to-many> and <many-to-one> sets, not <elements>.