-->
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: select new Object in Hibernate3
PostPosted: Thu Oct 12, 2006 7:10 pm 
Beginner
Beginner

Joined: Thu Oct 12, 2006 6:19 pm
Posts: 34
Location: Guatemala
Hi to @ll, I'm working with Hibernate3, I'm retrieving properties from several objects:
select a.property1, a.property2, b.property1.... from a, b
with HQL query.

I've created a plain class for get this property in a specific DTO:

Code:
List myList = query.list("select new myDTOClass(a.property, b.property1) from a, b ....");


but I'm getting this error:

    06/10/12 15:00:10 java.lang.NullPointerException
    06/10/12 15:00:10 at java.lang.Class.forName0(Native Method)
    06/10/12 15:00:10 at java.lang.Class.forName(Class.java:164)
    ...
    ...
    org.hibernate.QueryException: Incorrect query syntax [select new FisImpuestoDto(bi.codigoImpuesto, io.nombre, io.codigoFormulario) from gt.gob.sat.jfisat.jpista.backend.dto.FisBaImpuestoDto bi, gt.gob.sat.jfisat.jpista.backend.dto.FgImpuestoObligacion2Dto io where io.codigoImpObl = bi.codigoImpuesto and io.codigoTabla is not null and io.tipo = bi.tipo and io.tipo = 'I']
    at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:208)
    ...
    ...
    Caused by: java.lang.NullPointerException
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)



Anyone got the same error?

Thanks in advance

_________________
God is Love


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 13, 2006 5:21 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
I think you should add the package name to the class you try to instanciate in the query

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 13, 2006 11:00 am 
Beginner
Beginner

Joined: Thu Oct 12, 2006 6:19 pm
Posts: 34
Location: Guatemala
Thanks Mark, I've added myClass to my project, but I'm curious how the class is loaded in runtime? because HQL queries aren't pre-compiled, are these?

I'm getting the same error ...

_________________
God is Love


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.