mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 16:15:06 +00:00
HHH-14616 Oprimistic Lock throws org.hibernate.exception.SQLGrammarException: could not retrieve version
This commit is contained in:
parent
75bcb6bc0c
commit
e76a60cbfc
@ -166,6 +166,7 @@ public abstract class AbstractEntityPersister
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( AbstractEntityPersister.class );
|
||||
|
||||
public static final String ENTITY_CLASS = "class";
|
||||
public static final String VERSION_COLUMN_ALIAS = "v";
|
||||
|
||||
private final NavigableRole navigableRole;
|
||||
|
||||
@ -1721,7 +1722,7 @@ public String generateSelectVersionString() {
|
||||
SimpleSelect select = new SimpleSelect( getFactory().getDialect() )
|
||||
.setTableName( getVersionedTableName() );
|
||||
if ( isVersioned() ) {
|
||||
select.addColumn( versionColumnName );
|
||||
select.addColumn( getVersionColumnName(), VERSION_COLUMN_ALIAS );
|
||||
}
|
||||
else {
|
||||
select.addColumns( rootTableKeyColumnNames );
|
||||
@ -1947,7 +1948,7 @@ public Object getCurrentVersion(Serializable id, SharedSessionContractImplemento
|
||||
if ( !isVersioned() ) {
|
||||
return this;
|
||||
}
|
||||
return getVersionType().nullSafeGet( rs, getVersionColumnName(), session, null );
|
||||
return getVersionType().nullSafeGet( rs, VERSION_COLUMN_ALIAS, session, null );
|
||||
}
|
||||
finally {
|
||||
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( rs, st );
|
||||
|
Loading…
x
Reference in New Issue
Block a user