[Bugfix] fixed wrong implementation of Dao.hasElement()

This commit is contained in:
Robert von Burg 2014-08-04 15:36:25 +02:00
parent 5623f27f2d
commit 72d5bdce9e
1 changed files with 2 additions and 1 deletions

View File

@ -53,9 +53,10 @@ public abstract class PostgresqlDao<T extends StrolchElement> implements Strolch
@Override
public boolean hasElement(String type, String id) {
String sql = "select count(*) from " + getTableName() + " where type = ?";
String sql = "select count(*) from " + getTableName() + " where type = ? and id = ?";
try (PreparedStatement statement = this.tx.getConnection().prepareStatement(sql)) {
statement.setString(1, type);
statement.setString(2, id);
try (ResultSet result = statement.executeQuery()) {
result.next();
long numberOfElements = result.getLong(1);