Hi!
Here is my problem: I have a bean, lets say User, where I'd like to map one property to a custom function:
Code:
@Entity
public class User {
private int count;
@Formula("rowcount")
public int getCount() {return count;}
public void setCount(int count){this.count=count};
}
and then create two custom dialecs - one for Oracle and one for HSQL:
Code:
public static class CustomOracle10gDialect extends Oracle10gDialect {
public CustomOracle10gDialect() {
registerFunction("rowcount", new NoArgSQLFunction("count(*) over", Hibernate.INTEGER, true));
}
}
public static class CustomHSQLDialect extends HSQLDialect {
public CustomHSQLDialect() {
registerFunction("rowcount", new NoArgSQLFunction("1", Hibernate.INTEGER, false)); // don't really care about the output
}
}
because I need to use the same bean in the production code and in test units, and there is no "count(*) over()" function in HSQL..
Is that makes any sense? And is that possible somehow?
Thanks!