mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 12:44:49 +00:00
HHH-13763 : Update all load-by-key handling to use SQL AST
minor fix-ups
This commit is contained in:
parent
e112d9631e
commit
d5125d8e31
@ -67,7 +67,7 @@ public T load(Object naturalIdToLoad, LoadOptions options, SharedSessionContract
|
||||
final List<JdbcParameter> jdbcParameters = new ArrayList<>();
|
||||
final SelectStatement sqlSelect = LoaderSelectBuilder.createSelect(
|
||||
entityDescriptor,
|
||||
Collections.singletonList( entityDescriptor.getIdentifierMapping() ),
|
||||
Collections.emptyList(),
|
||||
naturalIdMapping,
|
||||
null,
|
||||
1,
|
||||
@ -113,7 +113,8 @@ public Object getBindValue() {
|
||||
);
|
||||
}
|
||||
|
||||
final List<Object[]> results = session.getFactory().getJdbcServices().getJdbcSelectExecutor().list(
|
||||
//noinspection unchecked
|
||||
final List<T> results = session.getFactory().getJdbcServices().getJdbcSelectExecutor().list(
|
||||
jdbcSelect,
|
||||
jdbcParamBindings,
|
||||
new ExecutionContext() {
|
||||
@ -138,7 +139,7 @@ public Callback getCallback() {
|
||||
};
|
||||
}
|
||||
},
|
||||
row -> row
|
||||
row -> (T) row[0]
|
||||
);
|
||||
|
||||
if ( results.size() > 1 ) {
|
||||
@ -150,8 +151,7 @@ public Callback getCallback() {
|
||||
);
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
return (T) results.get( 0 );
|
||||
return results.get( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -255,7 +255,7 @@ public Object resolveNaturalIdToId(
|
||||
final List<JdbcParameter> jdbcParameters = new ArrayList<>();
|
||||
final SelectStatement sqlSelect = LoaderSelectBuilder.createSelect(
|
||||
entityDescriptor,
|
||||
Collections.emptyList(),
|
||||
Collections.singletonList( entityDescriptor.getIdentifierMapping() ),
|
||||
naturalIdMapping,
|
||||
null,
|
||||
1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user