Joined: Tue Jul 27, 2004 1:17 pm Posts: 12
|
Is there a way to use a class constant in a query?
My query wants to check a field's value against one or more values and I'd rather use symbolic constants for the values. Thank you.
Hibernate version:2.1
Mapping documents:
/**
* @hibernate.query name="foo"
* query="from FooDTO foo where field = FooDTO.MYCONSTANT)
*/
public class FooDTO {
public static final int MYCONSTANT = 42;
private int field;
/**
* @hibernate.property
*/
public int getField() {
return field;
}
public void setField(int newField) {
field = newField;
}
}
The generated SQL (show_sql=true): SQL Error: 904, SQLState: 42000 FooDTO.MYCONSTANT: invalid indentifier
[
|
|