-->
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.  [ 3 posts ] 
Author Message
 Post subject: HQL Select Clause and constructor
PostPosted: Mon May 31, 2004 6:47 pm 
Newbie

Joined: Thu May 27, 2004 5:54 pm
Posts: 2
I am using 2.1.3 and have a question about using new in an HQL select. My NameDTO is not mapped which is what I want. Is it possible to use the NameDTO constructor without the NameDTO package name (refapp.NameDTO)? I have been searching the forum half the day and can't find an answer. This has got to be a really common question so I appologize if it is already answered.

String query = "select new refapp.NameDTO(mbr.mbrId, mbr.firstName,mbr.lastName) from Mbr as mbr";

Session s = HibernateUtil.currentSession();

Transaction tx = null;

List caseInfos = null;
try
{
caseInfos = s.find(query);
}
catch (Exception e)
{
if (tx!=null) tx.rollback();
s.close();
throw e;
}
finally
{
HibernateUtil.closeSession();
}

Thanks,

Bill


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 01, 2004 4:11 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I don't think so.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: HQL Select Clause and Construct
PostPosted: Tue Jun 01, 2004 10:48 am 
Newbie

Joined: Thu May 27, 2004 5:54 pm
Posts: 2
Wow. you guys are fast. Thanks for getting back to me so quickly. Given that I keep seeing examples that don't use the package name to reference the object in the HQL I thought I must be missing something really obvious. I hate it when I do that.

Thanks again,

Bill


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

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.