I have a query I want to be able to use to populate a composite-element property of a class. I have created this:
Code:
<bag name="Relationships">
<subselect>
select count(RelationID) as Relations, Relationship, EntityID from rcs.tblRelation_Link group by Relationship, EntityID
</subselect>
<key column="EntityID" />
<composite-element class="Relationship">
<many-to-one class="Lookup" name="RelationType" column="Relationship" />
<property name="Count" type="int" column="Relations" />
</composite-element>
</bag>
Which generates a query that looks like this:
Code:
SELECT relationsh0_.EntityID as EntityID0_,
relationsh0_.Relationship as Relation2_0_,
relationsh0_.Relations as Relations0_
FROM Relationships relationsh0_
WHERE relationsh0_.EntityID = '[i]guidvalue[/i]'
So clearly this is not the way to do what I am trying to do. Does anyone have a suggestion of how to use a query to populate elements like this short of creating a view on the database side? I would ideally like to keep everything in the app so it is obvious where it is coming from.
I may not have explained this completely so please do let me know if you I can clarify anything!
Thanks!