well, i'mnot sure if you've considered this, it would require a change to your data model, but you could have an abstract "Photos" class with a subclass for each type of photo (Gallery, Featured, Standard). Then you could have a collection of Photos in your parent class (Plan, Community) that is a polymorphic collection of photo objects.
Your mapping file for the Photo class might look like:
Code:
<class name="Photo" table="Photo">
<id name="id" column="PhotoID" type="Int32" unsaved-value="-1" access="field">
<generator class="identity" />
</id>
<joined-subclass name="GalleryPhoto" table="GalleryPhoto">
<key column="GalleryPhotoID" />
...
</joined-subclass>
<joined-subclass name="FeaturedPhoto" table="FeaturedPhoto"">
<key column="FeaturedPhotoID" />
... properties ...
</joined-subclass>
</class>
your data model could reflect this polymorphism as well...
and your Plan class might look like:
Code:
<set name="Photos"
cascade="all-delete-orphan"
lazy="true"
inverse="true"
<key columnid="PlanID" />
<one-to-many class="Photo"/>
</set>
I am using something like this for a company object that may or may not have a set of address object associated with it. Address is abstract and we have billing, mailing, etc.
HTH,
-devon[/code]