Hi,
I'm using J2EE 1.3.1 Sun RI and ran into this problem:
I have a serializeable class as a CMP Field (Permission) and
want to Do a findByPermission EJB query. (example code below).
Things I have checked:
- The dependant class in Serializeable (EJB SPEC 2.0 10.3.3)
- find Parameter is of the same class as CMP field as required for the
= operator (SPEC 2.0 11.2.10)
--------- EJB QL Statement ------------
SELECT OBJECT(perm) FROM PermissionSchema as perm
WHERE perm.permission = ?1
--------- EJB QL Statement ------------
But still the Deployment Tool complains (while generating SQL):
----
Invalid type of expression (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;
}
}
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".