I've got a class, GuestType, that includes a Role. When I save the GuestType, I have a validator to ensure that the Role is enabled:
Code:
@AssertTrue(message = "Role is disabled")
public Boolean validateRole() {
return this.getRole().isEnabled();
}
When I load up a GuestType and attempt to save it, I get an exception:
collection [com.example.orm.Role.Tags] was not processed by flush(). I will include my mappings below.
Does anyone know why this would happen? It seems to be able to load the Role fine during the validation process, but it's angry about something regarding the Tags that belong on that Role.
Any ideas?
Thanks,
Norman
Code:
<class name="com.example.orm.GuestType" table="GuestTypes">
<id name="Id" column="TypeID">
<generator class="native"/>
</id>
<property name="Name" not-null="true"/>
<property name="AccessCode" not-null="true"/>
<property name="Enabled" not-null="true" type="boolean" column="Status"/>
<many-to-one name="Role" column="RoleID" not-null="true" />
<many-to-one name="Schedule" column="ScheduleID" not-null="true" />
</class>
<class name="com.example.orm.Role" table="Roles">
<id name="Id" column="RoleID">
<generator class="native"/>
</id>
<property name="Name" not-null="true"/>
<property name="Enabled" not-null="true" type="boolean" column="Status"/>
<many-to-one name="DefaultSchedule" column="DefaultScheduleID" not-null="true" />
<list name="Tags" table="TagInstances" cascade="save-update" batch-size="50" where="TagID IN (SELECT t.TagID FROM Tags t WHERE t.Type='r')">
<key column="AppliesTo" />
<list-index column="Position" />
<many-to-many class="com.example.orm.Tag" column="TagID" />
</list>
</class>
<class name="com.example.orm.Tag" table="Tags">
<id name="id" column="TagID">
<generator class="native"/>
</id>
<discriminator column="Type" type="string" />
<property name="Name" not-null="true"/>
<property name="Inheritance" type="boolean" not-null="true"/>
<list name="Elements" table="TagElements" batch-size="30">
<key column="TagID" />
<list-index column="Position" />
<one-to-many class="com.example.orm.TagElement" />
</list>
<subclass name="com.example.orm.RoleTag" discriminator-value="r">
</subclass>
<subclass name="com.example.orm.OwnerTag" discriminator-value="o">
</subclass>
<subclass name="com.example.orm.ComputerTag" discriminator-value="c">
</subclass>
<subclass name="com.example.orm.InfractionReasonTag" discriminator-value="i">
</subclass>
</class>