Search in sources :

Example 76 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class GlusterServerServiceDaoImpl method getByClusterIdAndServiceType.

@Override
public List<GlusterServerService> getByClusterIdAndServiceType(Guid clusterId, ServiceType serviceType) {
    MapSqlParameterSource paramSource = getCustomMapSqlParameterSource();
    paramSource.addValue("cluster_id", clusterId);
    paramSource.addValue("service_type", EnumUtils.nameOrNull(serviceType));
    return getCallsHandler().executeReadList("GetGlusterServerServicesByClusterIdAndServiceType", serviceRowMapper, paramSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 77 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class VmDeviceDaoImpl method removeVmDevicesByVmIdAndType.

@Override
public void removeVmDevicesByVmIdAndType(Guid vmId, VmDeviceGeneralType type) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_id", vmId).addValue("type", type.getValue());
    getCallsHandler().executeModification("DeleteVmDevicesByVmIdAndType", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 78 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class VmDynamicDaoImpl method clearMigratingToVds.

@Override
public void clearMigratingToVds(Guid id) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_guid", id);
    getCallsHandler().executeModification("ClearMigratingToVds", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 79 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class VmDynamicDaoImpl method updateVmsToUnknown.

@Override
public void updateVmsToUnknown(List<Guid> vmIds) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_ids", createArrayOfUUIDs(vmIds)).addValue("status", VMStatus.Unknown);
    getCallsHandler().executeModification("SetToUnknown", parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource)

Example 80 with MapSqlParameterSource

use of org.springframework.jdbc.core.namedparam.MapSqlParameterSource in project ovirt-engine by oVirt.

the class VmDynamicDaoImpl method getAllRunningForVds.

@Override
public List<VmDynamic> getAllRunningForVds(Guid id) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vds_id", id);
    RowMapper<VmDynamic> mapper = createEntityRowMapper();
    return getCallsHandler().executeReadList("GetVmsDynamicRunningOnVds", mapper, parameterSource);
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic)

Aggregations

MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)505 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)82 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)63 Test (org.junit.jupiter.api.Test)48 ArrayList (java.util.ArrayList)36 EmptyResultDataAccessException (org.springframework.dao.EmptyResultDataAccessException)34 ResultSet (java.sql.ResultSet)33 InternalErrorException (cz.metacentrum.perun.core.api.exceptions.InternalErrorException)32 List (java.util.List)30 HashMap (java.util.HashMap)29 SQLException (java.sql.SQLException)25 Guid (org.ovirt.engine.core.compat.Guid)25 Collectors (java.util.stream.Collectors)16 CustomMapSqlParameterSource (org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource)16 Transactional (org.springframework.transaction.annotation.Transactional)16 java.util (java.util)13 Component (org.springframework.stereotype.Component)13 Map (java.util.Map)12 RowMapper (org.springframework.jdbc.core.RowMapper)11 Named (javax.inject.Named)10