[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1749) Convert discriminator field value into class name or class when discriminator field purposedly returned in query

Xavier Dury (JIRA) noreply at atlassian.com
Wed Aug 11 08:38:44 EDT 2010


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

Xavier Dury commented on HHH-1749:
----------------------------------

Hi, I would also like to be able to retrieve the entity-name/class-name through a query.

My use-case is the following:

We have an entity A (id, description, bigLobContent) and some other entities B and C which both extend A.
We want to show the user a list of A's without loading bigLobContent, so we have a special View/DTO:

  "select new ADTO(a.id, a.description, a.class) from A a where ..."

but we would like to keep and display the real type of object the DTO was referring to.

Actually, doing something like

  "select a.id, a.description, a.class from A a"

will result in something like [42, 'blah', 2] whereas

  "select a.class from A a"

will give an error.




> Convert discriminator field value into class name or class when discriminator field purposedly returned in query
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-1749
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1749
>             Project: Hibernate Core
>          Issue Type: Improvement
>    Affects Versions: 3.0.5
>         Environment: Win XP SP2, JDK 1.5.0_05, Hibernate 3.0.5
>            Reporter: Ignat Zapolsky
>
> It is possible to obtain discriminator field by specifying it in query, it is possible to use it since hibernate automatically replaces entity.class with discriminator column and converts class into associated discriminator value. But retreival of such field is useless since user cannot obtain .class from returned discriminator value and Hibernate expects .class, not discriminator in queries.
> Sample query : select cat.class from my.Cat as cat where ...

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