[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4917) Keyword TYPE not supported

Steve Ebersole (JIRA) noreply at atlassian.com
Wed Feb 17 13:53:47 EST 2010


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

Steve Ebersole commented on HHH-4917:
-------------------------------------

Usage in select clause is now acconted for.  

The spec does not explicitly define the type of the return when used in the select clause.  The most logical is the java.lang.Class reference which was unfortunately much different than our current ".class" psuedo property behavior.  So these are currently handled very differently.  At some point we should come back and align so that ".class" is the select returns the Class ref as well.

Note too that returning Class is only valid for EntityMode.POJO.  For other entity modes, I return the entity name.    

> Keyword TYPE not supported
> --------------------------
>
>                 Key: HHH-4917
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4917
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-hql
>    Affects Versions: 3.5.0-CR-1
>            Reporter: Juergen Zimmermann
>            Assignee: Steve Ebersole
>             Fix For: 3.5.0-CR-2
>
>          Time Spent: 5 hours, 23 minutes
>  Remaining Estimate: 0 minutes
>
> The keyword TYPE according to JPA 2 cannot be used:
> In PostgreSQL:
> CREATE TABLE kunde(
> 	k_id BIGSERIAL NOT NULL PRIMARY KEY,
> 	...
> 	art CHAR(1) DEFAULT 'P'
> );
> Entity classes:
> @Entity
> @Table(name="kunde")
> @Inheritance
> @DiscriminatorColumn(name="art", length=1)
> @NamedQueries({
> @NamedQuery(name = "typeSample",
> query = "SELECT k FROM  Kunde k WHERE TYPE(k) IN (Privatkunde, Firmenkunde)")
> })
> public abstract class Kunde implements java.io.Serializable {...}
> @Entity
> @DiscriminatorValue("P")
> public class Privatkunde extends Kunde {...}
> public abstract class Kunde implements java.io.Serializable {...}
> Wrong generated SQL query:
> select
>     ... 
> from
>     kunde kunde0_ 
> where
>     TYPE(kunde0_.k_id) in (
>         'P' , 'F'
>     )

-- 
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