-->
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.  [ 2 posts ] 
Author Message
 Post subject: Unable to find constructor when using varargs with class
PostPosted: Wed Mar 14, 2012 7:49 pm 
Newbie

Joined: Wed Mar 14, 2012 7:33 pm
Posts: 1
I got an exception by hibernate which is,

"Caused by: org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class"

My query is "Select new example.ReportField(r.memberName, r.address) from Member r"

public class ReportField {

public List<String> fieldValueList = new ArrayList<String>();

public ReportField(Object... fields){
System.out.println("-----ReportField------" );
if (fields != null) {
for (Object field : fields) {
String fieldStr = field.toString();
String[] temp = fieldStr.split(":");
System.out.println("temp.length = " + temp.length);
if (temp != null && temp.length == 2
&& "uuid".equals(temp[0].toLowerCase())) {
fieldValueList.add(SysUtil.getNodeByUUID(temp[1]));
} else {
fieldValueList.add(fieldStr);
}
}
}
}

public List<String> getFieldValueList() {
return fieldValueList;
}

public void setFieldValueList(List<String> fieldValueList) {
this.fieldValueList = fieldValueList;
}
}

If I change the consturctor to
public ReportField(String memberName, String memberAddress) and it works

Thanks


Top
 Profile  
 
 Post subject: Re: Unable to find constructor when using varargs with class
PostPosted: Thu Feb 27, 2014 4:24 am 
Newbie

Joined: Thu Feb 27, 2014 4:08 am
Posts: 3
Location: Frankfurt, Germany
To me it´s the contrary: I have a named query with strings and if I change the data type to Object in the constructor works...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.