Note that there are some explanatory texts on larger screens.

plurals
  1. POCF9 HQL Statement for many-to-many and Multiple Criteria
    text
    copied!<p>I have the following setup:</p> <p>Listing.cfc</p> <pre><code>component persistent="true" { property name="ListingId" column="ListingId" type="numeric" ormtype="int" fieldtype="id" generator="identity"; ... property name="Features" type="array" hint="Array of features" singularname="Feature" fieldtype="many-to-many" cfc="Feature" linktable="Listing_Feature" FKColumn="ListingId" inversejoincolumn="FeatureId"; } </code></pre> <p>Feature.cfc</p> <pre><code>component persistent="true" table="Feature" schema="dbo" output="false" { property name="FeatureId" column="FeatureId" type="numeric" ormtype="int" fieldtype="id" generator="identity"; property name="FeatureDescription" column="FeatureDescription" type="string" ormtype="string"; ... /*property name="Listings" fieldtype="many-to-many" cfc="Listing" linktable="Listing_Feature" fkcolumn="FeatureId" inversejoincolumn="ListingId" lazy="true" cascade="all" orderby="GroupOrder";*/ } </code></pre> <p>I can select all listings that have a particular feature using:</p> <pre><code>&lt;cfset matchingListings = ormExecuteQuery("from Listing l left join l.Features as feature where feature.FeatureId = :feature",{feature = 110}) /&gt; </code></pre> <p>Which is fine, however, I'd like to be able to select all listings that have multiple features (for example a listing that has both "Dishwasher" AND "Garage")</p> <p>After a couple hours of googling and looking through hibernate documentation haven't been able to find a solution that won't give me an error. My guess is that the solution is pretty simple and I am just over-thinking it...anyone have any suggestions?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload