Hi,
I have a Serializeable Object in a CMP(2.0) Entity Bean.
I'm unable to define a proper QL, that is accepted by the Sun
J2EE 1.3.1 RI:
---------- EJB QL ----------
SELECT OBJECT (perm)
FROM PermissionBeanSchema AS perm
WHERE perm.permission = ?1
---------- EJB QL ----------
As far as I understand, I have fullfilled all requirements:
- class Permission is serializable and implements an equals method
- field permission is declared as CMP field inside the Bean.
- the parameter in findByPermission(Parameter) is the same Object
class as the persistence field.
But still the EQL Compiler complains about '(perm.permission = ?1)'.
Any Ideas ??
-----------
Java example code -----------
public abstract class PermissionBean implements EntityBean{
public abstract void setPermission(Permission perm);
public abstract Permission getPermission();
[...]
}
public interface PermissionHomeLocal extends EJBLocalHome {
[...]
public PermissionLocal findByPermission(Permission permission)
throws FinderException;
}
public class Permission implements Serializable {
public final static Permission CREATE_USER = new Permission("Create User", "Allows User Creation");
final private
String name;
final private String description;
private Permission (final String name, final String description){
this.name = name;
this.description = description;
}
public String getName() { return this.name; }
public String getDescription() { return this.description; }
public boolean equals(Object obj) {
if (obj instanceof Permission) {
Permission perm = (Permission) obj;
return this.name.equals(perm.getName());
}
return false;
}
}
[ June 19, 2004: Message edited by: Skripi Mayer ]