Escape entity fields name when required

Description

I have a class defined like this :

@Entity
@Audited
public class foo {
@Column(name="`SERIAL#`")
private String serial_;
...
}

Hibernate generates sucessfully an insert statement :

insert into foo("SERIAL#") values;

whereas Hibernate Envers failed by generating :

insert into foo_aud(REVTYPE, SERIAL#, REV) values(?, ?, ?); – Note the absence of double quotes

Activity

benjamin fuentesMarch 25, 2014 at 3:06 PM

v 3.6.10 correct @Column bug with backquote but not @JoinColumn.
I will hack field names on audit tables letting joincolumn fields in lowercase

benjamin fuentesMarch 24, 2014 at 5:22 PM

ok

thanks Brett Meyer, i think i don't have other choice than migrating to 3.6.x

i cross my fingers

Brett MeyerMarch 24, 2014 at 5:12 PM

Sorry , ORM 3 is no longer maintained.

benjamin fuentesMarch 24, 2014 at 4:58 PM

is there any patch for Envers version 3.5 ?

i am stuck in my project with the error

Caused by: org.hibernate.QueryException: unexpected char: '"' [select e from com.ecc.bo.bill.Bill"_AUD" e where e.REVTYPE <> :_p1 and e.originalId.REV.id = (select max(e2.originalId.REV.id) from com.ecc.bo.bill.Bill"_AUD" e2 where e2.originalId.REV.id <= :_p0 and e.originalId.id = e2.originalId.id) and e.originalId.id = :_p2]

I added this property to hack the bug. Is working while storing data but not or retrieving data using auditReader

<property name="org.hibernate.envers.audit_table_suffix" value='"_AUD"'/>

my table is "BILL"
my audit table is "BILL""_AUD"

Brett MeyerMarch 7, 2014 at 10:08 PM

Bulk closing tickets resolved in released versions

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created March 31, 2011 at 10:31 AM
Updated March 25, 2014 at 3:06 PM
Resolved April 19, 2011 at 7:35 PM