Can I pass "class" parameter to query?
I have such mapping:
Code:
<class name="DPUserGroupType" table="DP_USER_GROUP_TYPES" >
<id name="id" type="string" >
<!-- <column name="ID" sql-type="number" not-null="true"/>-->
<generator class="com.amfitel.common.hb.StringSequenceGenerator">
<param name="sequence" >DP_USER_GROUPS_SEQ</param>
</generator>
</id>
<discriminator column="ID"/>
<property name="name" type="string" />
<subclass name="DPAuthUserGroupType" discriminator-value="1" />
<subclass name="DPDispatchUserGroupType" discriminator-value="2" />
</class>
<class name="DPUserGroup" table="DP_USER_GROUPS" lazy="true" >
<id name="id" type="string" unsaved-value="null" >
<column name="ID" sql-type="number" not-null="true"/>
<generator class="com.amfitel.common.hb.StringSequenceGenerator">
<param name="sequence" >DP_USER_GROUPS_SEQ</param>
</generator>
</id>
<property name="name" type="string" />
<many-to-one name="type" column="TYPE_ID" not-null="true" class="DPUserGroupType" />
<set name="users" table="DP_USR_GRP_ENTRIES" inverse="true" lazy="true" >
<key column="GROUP_ID"/>
<many-to-many column="USER_ID" class="DPUser" />
</set>
<set name="subscriptions" lazy="true" inverse="true" >
<key column="GROUP_ID"/>
<one-to-many class="DPSubscription" />
</set>
</class>
I want to execute this query:
Code:
select userGroup from com.amfitel.dp.bl.DPUser user join user.groups userGroup
where user.id=:id and userGroup.type.class=:cl
So when I pass cl parameter as string "com.amfitel.dp.bl.DPAuthUserGroupType", I get exception - java.sql.SQLException: ORA-01722
So is this not supported? And how can I avoid this?