-->
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: Hibernate HQL Select new Constructor Using VarArgs.
PostPosted: Fri Jul 27, 2012 12:28 pm 
Newbie

Joined: Sun Nov 13, 2011 4:35 pm
Posts: 6
I am using hibernate Version 3.2.5 i have a HQL like this:
select new org.com.Utilities.Inventario.ReporteInventario(P.Id,P.Name,DP.Rotacion,LongResult,IntegerResult,IntegerResult,IntegerResult,IntegerResult,IntegerResult,IntegerResult)
and i have a constructor in this way:
public ReporteInventario(String CodPro,String NomProd,String RotProd,Long TotalStock,Integer Val1,Integer Val2, Integer Val3,Integer Val4,Integer Val5,Integer Val6)
works OK. But i have tried the following:

public ReporteInventario(String CodPro,String NomProd,String RotProd,Long TotalStock,Integer.. VarArgs)
But i'm receiving not Compliant Constructor found. i am not big fan of verbosity. my question is can i use Varargs in my Constructor whose Hibernate can populate. why hibernate not populate my Constructor why do not detect a list of integers and populate as VarArgs.
i also have try. as a list.
Select new org.com.Utilities.Inventario.ReporteInventario(P.Id,P.Name,DP.Rotacion,(Select sum(DP.Stock) from DP where P.Id=DP.Producto.Id),new list((Select DP.Stock as Stock0 from DP where P.Id=DP.Producto.Id And DP.Sucursal.Id=1200),(Select DP.Stock as Stock1 from DP where P.Id=DP.Producto.Id And DP.Sucursal.Id=1300)))
but is giving error on new list. my question is to avoid verbosity how can i use a constructor avoiding to coding the constructor Select new org.com.Utilities.Inventario.ReporteInventario(P.Id,P.Name,DP.Rotacion,(Select sum(DP.Stock) from DP where P.Id=DP.Producto.Id,Integer,Integer,Integer,Integer,Integer) thanks a lot sorry by my poor english.


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.