I am using
@Formula("cast(item_code as \"int\")")
to cast a String
column to int
but hibernate
is generating the query as
and cast(this_.item_code as this_."int")=?
How do i get rid of the alias
in front of int
?
I tried :
@Formula("cast(item_code as "int")")
and @Formula("cast(item_code as int)")
but still the same error . How do i cast the String
to int
?
Thanks in advance .
I have resolved an issue similar to yours. I extended the hibernate Dialect class for my database.
public class Oracle10gDialectExtended extends Oracle10gDialect {
public Oracle10gDialectExtended() {
super();
/* types for cast: */
registerKeyword("int");
// add more reserved words as you need
}
}
Set 'hibernate.dialect' property with this new class. Now your @Formula will work.
来源:https://stackoverflow.com/questions/25679818/hibernate-formula-is-not-supportinng-cast-as-int-for-teradata-database