mirror of
https://github.com/pcvolkmer/mv64e-onkostar-data.git
synced 2025-07-04 03:22:53 +00:00
chore: do not throw exception if no subform data found
This commit is contained in:
@ -1,6 +1,5 @@
|
|||||||
package dev.pcvolkmer.onco.datamapper.datacatalogues;
|
package dev.pcvolkmer.onco.datamapper.datacatalogues;
|
||||||
|
|
||||||
import dev.pcvolkmer.onco.datamapper.exceptions.DataAccessException;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -27,16 +26,10 @@ public abstract class AbstractSubformDataCatalogue extends AbstractDataCatalogue
|
|||||||
* @return The procedure id
|
* @return The procedure id
|
||||||
*/
|
*/
|
||||||
public List<ResultSet> getAllByMainId(int id) {
|
public List<ResultSet> getAllByMainId(int id) {
|
||||||
var result = this.jdbcTemplate.query(
|
return this.jdbcTemplate.query(
|
||||||
String.format("SELECT * FROM %s JOIN prozedur ON (prozedur.id = %s.id) WHERE hauptprozedur_id = ?", getTableName(), getTableName()),
|
String.format("SELECT * FROM %s JOIN prozedur ON (prozedur.id = %s.id) WHERE hauptprozedur_id = ?", getTableName(), getTableName()),
|
||||||
(resultSet, i) -> resultSet,
|
(resultSet, i) -> resultSet,
|
||||||
id);
|
id);
|
||||||
|
|
||||||
if (result.isEmpty()) {
|
|
||||||
throw new DataAccessException("No record found for parent id: " + id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user