-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Nested select new query
PostPosted: Mon Dec 05, 2011 10:15 am 
Newbie

Joined: Mon Jun 21, 2010 9:03 am
Posts: 7
Dear Folks!

I searched the web and the forum and I did not find an answer if the following query is possible (Simplified)

Domain Model:
Code:
public class Entity {
    private Long Id;

    private String prop1;

    private String prop2;
}


Code:
public class DTO1{
   private final Long id;
   public DTO1(Long id){
      this.id = id;
   }
}


Code:
public class DTO2{
   private final String prop1;
   public DTO1(String prop1){
      this.prop1= prop1;
   }
}


Code:
public class AggregateDTO{
   private final DTO1 dto1;
   private final DTO2 dto2;
   public AggregateDTO(DTO1 dto1, DTO2){
      this.dto1 = dto1;
      this.dto2 = dto2;
   }
}


I would like to execute following query:

Code:
select new AggregateDTO(new DTO1(e.id), new DTO2(e.prop1))
FROM Entity e


I get the errormessage 'unexpected token new'.
I found a ticket to this topic since 2004. Is this feature still open, or is it already solved?
https://hibernate.onjira.com/browse/HHH-37


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.