Hibernate version: 3.0
Hi ,
Iam trying to use select "new" in Hql,Iam getting excetion..
String SQL_QUERY="select new PatRow (pat.mpi,pat.nameDisplay,pat.birthDate) from Pat pat ";
PatRow is a class which has all the constructors for creating the objects..
Hibernate: select pat0_.mpi as col_0_0_, pat0_.name_display as col_1_0_, pat0_.birthdate as col_2_0_ from pat pat0_ **************END***************** at : 0 org.hibernate.QueryException: Could not instantiate: class fccc.phs.hibernate.PatRow at org.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:117) at org.hibernate.impl.IteratorImpl.<init>(IteratorImpl.java:62) at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:382) at org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:278) at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:865) at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:41) at fccc.phs.hibernate.PatDAO.getPatInfo(PatDAO.java:48) at fccc.phs.hibernate.GetPatientInfo.main(GetPatientInfo.java:15)
Caused by: java.lang.IllegalArgumentException: wrong number of arguments at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:113) ... 7 more:
If i use only one argument for the constructor like :
select new PatRow(pat.mpi) from Pat pat
Iam not having any problem for the one argument..
While i have constructors for the 3 arguments used in first hql query,I dont undestand why is it complaining about illegal number of arguments..Any help is appreciated..
Thnx.
|