How to force Hibernate-Envers to use quotes around fields name?
I have a table with properties defined like this :
@Column(name="\"SERIAL#\"")
When Hibernate inserts data, everything works fine. But it comes to Hibernate-Envers(HE), HE forgets to surround the field name with doublequotes.
How can i force it to use th开发者_如何学运维e doublequotes aroud the fields ?
Do you want to use double quotes, or do you want to escape the name? If you just want to escape, use backticks (`) and Hibernate will convert it to whatever mechanism your database uses for escaping. So, your example would be:
@Column(name="`SERIAL#`")
Just out of curiosity: why do you need a # in a column name? I always thought that special chars are a bad idea in identifiers :-)
For solving the problem, i manage to not use the '#' in the field name thus neither Hibernate nor Hibernate Envers have to escape the field name.
EDIT:
In fact it's a bug in Hibernate Envers 3.6.2.Final. It should be solved later.
EDIT 2: The bug has been fixed in Hibernate Envers 3.6.3 and Hibernate Envers 4.0.0Alpha.
EDIT 3: The bug has been fixed in Hibernate Core 3.6.4.Final.
精彩评论