Menu

#8 Add ability to use DTC in DAO

1.0.0
open
influx-dao (4)
9
2008-11-26
2008-11-26
Will Hoover
No

Add ability to pass a list of property paths to the keyword search (or any other find method) that will be used to hydrate those properties in the result.

Example implementation:

<code>
public final IEntityCollection<Collection<Actor>, Actor> findByKeywordWithHydratedAssociations(final String keyword, final List<IPropertyPath> matchOnPropertyPaths, final Integer startIndex,
final Integer recordCount, final LinkedHashMap<String, Boolean> sortByProperties, final String distinctModelPropertyName, final List<IPropertyPath> associationPaths) {
final Criteria criteria = getCriteria(getPersistentClass(), ALIAS_ACTOR);
if (associationPaths != null) {
for (IPropertyPath path : associationPaths) {
if (path.getQualifiedName() == null || path.getQualifiedName().isEmpty()) {
throw new NullPointerException("Association property path cannot be null");
}
criteria.createAlias(path.getQualifiedName(), (path.getAliasForQualifiedName() != null && !path.getAliasForQualifiedName().isEmpty()) ? path.getAliasForQualifiedName() : path
.getQualifiedName(), JoinFragment.LEFT_OUTER_JOIN);
}
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
}
return super.findByKeyword(keyword, matchOnPropertyPaths, startIndex, recordCount, sortByProperties, distinctModelPropertyName, criteria, new Criterion[] {});
}
</code>

Discussion


Log in to post a comment.