I have a "product' entity with some property,
product & property mapping:
<map name="properties" lazy="true" table="ProductProp">
<key column="ProductID"/>
<index column="PropName" type="string"/>
<element type="string" column="PropValue" not-null="true"/>
</map>
now, i want to get a property with a productid & name
Product product = ...//load a product by id
product.getProperties().get(name) //get the propery
these code generate two sql:
select ... from Product where ProductID = x
select ... from ProductProp where ProductID = x
is there someway just one sql to fetch the property, just like direct jdbc:
select ... from ProductProp where ProductID = x and PropName = x
|