on 09-14-2012 9:57 AM
Hello,
I'm facing the following problem and ask you kindly for your help.
I've got entity beans for representing an SQL database. Now I wanted to do a query and fill with it an own data transfer object (DTO) for later use. The query looks somewhat like: (real names replaced)
SELECT new package.folder.Object(q.attribute1, q.attribute2, q.attribute3)
FROM Qualification q
WHERE ......
The constructor of the referring object's class looks like:
public Object(String attribute1, EntityObject attribute2, int attribute3){
....
}
The error I get is:
javax.persistence.PersistenceException: The class >>package.folder.Object<< is used in a constructor expression but the constructor cannot be determined unambigously. The arguments types are: java.lang.String; java.lang.String; int;
I already checked the data types in the DB, the right order in query and cinstructor, I also altered the query with other data types, but nothing changed.
AND there's also only one constructor in the class file. So why does it say the constructor isn't to find "unambigously"?
A strange thing is that the same construct works for another query quite fine. But that other query hasn't been made by me. The only difference is that in the query that works only "native" data types are used as constructor parameters. Maybe that's it? I cannot use entity objects as parameters?
Does anybody have an idea? I appreciate anything that might help.
Kind regards
Jana
Obviously that's the case. For some reason the system does not know at compile time what type is behind the object you are using. But it needs to. For this reason it throws an error.
Regards,
Benny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.