Hi all!
I have created a class which extends java.security.BasicPermission, but when trying to get the list of them from the database, using the list() method, I have the following error:
Code:
net.sf.hibernate.InstantiationException: Could not instantiate entity: es.xxx.xxxx.security.ParsysPermission
Here is the class:
Code:
public class ParsysPermission extends BasicPermission {
private Long code;
private String permissionName;
public ParsysPermission()
{
super("");
}
public boolean equals( Object o )
{
if( o instanceof ParsysPermission )
{
ParsysPermission other = (ParsysPermission) o;
return (
(this.code.equals(other.getCode())) &&
(this.permissionName.equals(other.getPermissionName()))
);
}
return false;
}
public int hashCode()
{
return code.hashCode() ^ permissionName.hashCode();
}
public Long getCode() {
return code;
}
public void setCode(Long code) {
this.code = code;
}
public String getPermissionName() {
return permissionName;
}
public void setPermissionName(String permissionName) {
this.permissionName = permissionName;
}
}
And this will be the mapping:
Code:
<class name="es.xxx.xxxx.security.ParsysPermission">
<id name="code" type="long" column="code" unsaved-value="null">
<generator class="native" />
</id>
<property name="permissionName" type="string" />
</class>
The HQL query I'm trying to create is the following:
Code:
from ParsysPermission as per order by per.permissionName asc
Why I'm having this exception?
Thanks in advance!