[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5282) Query Parameters not supported for Entity Type Expression

Simon Martinelli (JIRA) noreply at atlassian.com
Tue Jun 1 10:51:35 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37314#action_37314 ] 

Simon Martinelli commented on HHH-5282:
---------------------------------------

Extract from JPA 2.0 Spec:

4.6.17.4 Entity Type Expressions
An entity type expression can be used to restrict query polymorphism. The TYPE operator returns the exact type of the argument.

The syntax of an entity type expression is as follows:
entity_type_expression ::=
type_discriminator |
entity_type_literal |
input_parameter
type_discriminator ::=
TYPE(identification_variable |
single_valued_object_path_expression |
input_parameter )

An entity_type_literal is designated by the entity name.

The Java class of the entity is used as an input parameter to specify the entity type.

Examples:
SELECT e
FROM Employee e
WHERE TYPE(e) IN (Exempt, Contractor)

SELECT e
FROM Employee e
WHERE TYPE(e) IN (:empType1, :empType2)

SELECT e
FROM Employee e
WHERE TYPE(e) IN :empTypes

SELECT TYPE(e)
FROM Employee e
WHERE TYPE(e) <> Exempt

> Query Parameters not supported for Entity Type Expression
> ---------------------------------------------------------
>
>                 Key: HHH-5282
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5282
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.5.2
>            Reporter: Simon Martinelli
>
> Trying to use Entity Type Expression with query parameter result in an exception:
> org.hibernate.hql.ast.QuerySyntaxException: unexpected token: : near line 1, column 90 [select k from ch.bkw.zlsc.domain.stammdaten.vse.VSEStatistikKategorie k where TYPE(k) in :typs and k.sortierung like :keyword]
> Using dynamic query instead of parameters works.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list