Reputation:
My class begins with:
@Entity
@Table(name = "validate_info", catalog = "company")
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id")
public class ValidateInfo implements java.io.Serializable{
And my HQL Query:
List<ValidateInfo> lResult = null;
String lHql = " from ValidateInfo vi "
+ " where vi.document.idDocument in (:documentsList) "
+ " and vi.idEntityType = :idEntityType";
Query lQuery = pSession.createQuery(lHql);
lQuery.setParameterList("documentsList", pDocumentsList);
lQuery.setParameter("idEntityType", pIdEntityType);
lResult = lQuery.list();
The error I get:
[T0028][SEVER] .web.Control.execute() RunService returns Exception ValidateInfo is not mapped [ from ValidateInfo vi where vi.document.idDocument in (:documentsList) and vi.idEntityType = :idEntityType]
[T0028][SEVER] .web.Control.manageError() java.util.HashMap cannot be cast to java.util.List
Can you guys help me? I don't know why i get the "not Mapped" error, the name of the HQL query table is the same as the classname.
Upvotes: 1
Views: 152
Reputation: 15399
When you write an HQL
query you must write the complete path of your used class.
So you can replace your code as follow:
String lHql = " from " + ValidateInfo.class.getName() + " vi "
+ " where vi.document.idDocument in (:documentsList) "
+ " and vi.idEntityType = :idEntityType";
Upvotes: 2