Skip to content

Commit

Permalink
HHH-14616 Oprimistic Lock throws org.hibernate.exception.SQLGrammarEx…
Browse files Browse the repository at this point in the history
…ception: could not retrieve version
  • Loading branch information
dreab8 authored and Sanne committed May 24, 2021
1 parent 2a571ae commit 1b50cfa
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -165,6 +165,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;

Expand Down Expand Up @@ -1709,7 +1710,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 );
Expand Down Expand Up @@ -1935,7 +1936,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 );
Expand Down

0 comments on commit 1b50cfa

Please sign in to comment.