public boolean visitIdentificationVariable(EJBQLExpression expression) {
// this is a match on a variable, like "x = :x"
ClassDescriptor descriptor = context.getEntityDescriptor(expression.getText());
if (descriptor == null) {
throw new EJBQLException("Invalid identification variable: "
+ expression.getText());
}
DbEntity table = descriptor.getEntity().getDbEntity();
String alias = context.getTableAlias(expression.getText(), table
.getFullyQualifiedName());
Collection<DbAttribute> pks = table.getPrimaryKeys();
if (pks.size() == 1) {
DbAttribute pk = pks.iterator().next();
context.append(' ').append(alias).append('.').append(pk.getName());
}
else {
throw new EJBQLException(
"Multi-column PK to-many matches are not yet supported.");
}
return false;
}