* @return a collection of chronicle surrogates
* @throws T2DBException
*/
public Collection<Surrogate> findChronicles(Property<?> property, Collection<UpdatableSchema> schemas) throws T2DBException {
Collection<Surrogate> result = new ArrayList<Surrogate>();
Database database = property.getSurrogate().getDatabase();
// expensive
Set<Integer> schemaIds = new HashSet<Integer>(schemas.size());
for(UpdatableSchema s : schemas) {
schemaIds.add(getId(s));
}
try {
find_entity_with_property = open(FIND_ENTITY_WITH_PROPERTY, property, find_entity_with_property);
find_entity_with_property.setInt(1, getId(property));
ResultSet rs = find_entity_with_property.executeQuery();
while(rs.next()) {
if (schemaIds.contains(rs.getInt(1))) {
Surrogate entityKey = makeSurrogate(database, DBObjectType.CHRONICLE, rs.getInt(1));
Schema schema = database.getChronicle(entityKey).getSchema(true); // hope caching is on
if (schemaIds.contains(getId(schema)))
result.add(entityKey);
}
}
} catch (Exception e) {