public final T getBy(String columnName, Object value) {
try (Connection con = Db.getConnection();
PreparedStatement pstmt = con.prepareStatement("SELECT * FROM " + table()
+ " WHERE " + columnName + " = ?" + (multiversion ? " AND latest = TRUE LIMIT 1" : ""))) {
if(value instanceof Long){
pstmt.setLong(1, (Long)value);
}else if(value instanceof Boolean){
pstmt.setBoolean(1, (Boolean)value);
}else if(value instanceof String){
pstmt.setString(1, (String)value);
}
return get(con, pstmt);
} catch (SQLException e) {
throw new RuntimeException(e.toString(), e);
}
}