Using JPA2 specific quoting character (double quote) for JoinColumn results in DuplicateMappingException.

Description

A JoinColumn like the following:

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="\"NAME#\"", insertable=false, updatable=false)
private OutTx transaction;

will result in:

org.hibernate.DuplicateMappingException: Table [XYZ contains phyical column name [`NAME#`] represented by different logical column names: [`NAME#`], ["NAME#"]

It seems like these lines in EJB3JoinColumn.addColumnBinding() won't replace the mapping with backticks:

if ( StringHelper.isQuoted( getLogicalColumnName() ) || StringHelper.isQuoted( getLogicalColumnName() ) ) {
logicalColumnName = StringHelper.quote( logicalColumnName );
}

Environment

None

Status

Assignee

Brett Meyer

Reporter

Dave Stephan

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure