use of org.hibernate.procedure.spi.NamedCallableQueryMemento in project hibernate-orm by hibernate.
the class NamedObjectRepositoryImpl method prepare.
@Override
public void prepare(SessionFactoryImplementor sessionFactory, MetadataImplementor bootMetamodel, BootstrapContext bootstrapContext) {
bootMetamodel.visitNamedHqlQueryDefinitions(namedHqlQueryDefinition -> {
final NamedSqmQueryMemento resolved = namedHqlQueryDefinition.resolve(sessionFactory);
sqmMementoMap.put(namedHqlQueryDefinition.getRegistrationName(), resolved);
});
bootMetamodel.visitNamedNativeQueryDefinitions(namedNativeQueryDefinition -> {
final NamedNativeQueryMemento resolved = namedNativeQueryDefinition.resolve(sessionFactory);
sqlMementoMap.put(namedNativeQueryDefinition.getRegistrationName(), resolved);
});
bootMetamodel.visitNamedResultSetMappingDefinition(namedResultSetMappingDefinition -> {
final NamedResultSetMappingMemento resolved = namedResultSetMappingDefinition.resolve(() -> sessionFactory);
resultSetMappingMementoMap.put(namedResultSetMappingDefinition.getRegistrationName(), resolved);
});
bootMetamodel.visitNamedProcedureCallDefinition(namedProcedureCallDefinition -> {
final NamedCallableQueryMemento resolved = namedProcedureCallDefinition.resolve(sessionFactory);
callableMementoMap.put(namedProcedureCallDefinition.getRegistrationName(), resolved);
});
}
use of org.hibernate.procedure.spi.NamedCallableQueryMemento in project hibernate-orm by hibernate.
the class AbstractSharedSessionContract method getNamedProcedureCall.
@Override
@SuppressWarnings("UnnecessaryLocalVariable")
public ProcedureCall getNamedProcedureCall(String name) {
checkOpen();
final NamedCallableQueryMemento memento = factory.getQueryEngine().getNamedObjectRepository().getCallableQueryMemento(name);
if (memento == null) {
throw new IllegalArgumentException("Could not find named stored procedure call with that registration name : " + name);
}
final ProcedureCall procedureCall = memento.makeProcedureCall(this);
// procedureCall.setComment( "Named stored procedure call [" + name + "]" );
return procedureCall;
}
use of org.hibernate.procedure.spi.NamedCallableQueryMemento in project hibernate-orm by hibernate.
the class NamedObjectRepositoryImpl method resolve.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Prepare repository for use
@Override
public NamedQueryMemento resolve(SessionFactoryImplementor sessionFactory, MetadataImplementor bootMetamodel, String registrationName) {
NamedQueryMemento namedQuery = sqlMementoMap.get(registrationName);
if (namedQuery != null) {
return namedQuery;
}
namedQuery = sqmMementoMap.get(registrationName);
if (namedQuery != null) {
return namedQuery;
}
namedQuery = callableMementoMap.get(registrationName);
if (namedQuery != null) {
return namedQuery;
}
final NamedHqlQueryDefinition namedHqlQueryDefinition = bootMetamodel.getNamedHqlQueryMapping(registrationName);
if (namedHqlQueryDefinition != null) {
final NamedSqmQueryMemento resolved = namedHqlQueryDefinition.resolve(sessionFactory);
sqmMementoMap.put(namedHqlQueryDefinition.getRegistrationName(), resolved);
return resolved;
}
final NamedNativeQueryDefinition namedNativeQueryDefinition = bootMetamodel.getNamedNativeQueryMapping(registrationName);
if (namedNativeQueryDefinition != null) {
final NamedNativeQueryMemento resolved = namedNativeQueryDefinition.resolve(sessionFactory);
sqlMementoMap.put(namedNativeQueryDefinition.getRegistrationName(), resolved);
return resolved;
}
final NamedProcedureCallDefinition namedCallableQueryDefinition = bootMetamodel.getNamedProcedureCallMapping(registrationName);
if (namedCallableQueryDefinition != null) {
final NamedCallableQueryMemento resolved = namedCallableQueryDefinition.resolve(sessionFactory);
callableMementoMap.put(namedCallableQueryDefinition.getRegistrationName(), resolved);
return resolved;
}
return null;
}
Aggregations