- if (entityType != null)
- xpathQueryStr = entityType.contains(":") ? "//element(*, " + entityType + ")"
- : "//element(*, " + EntityTypes.ENTITY_ENTITY + ")[@entity:type='" + entityType + "']";
- else
- xpathQueryStr = "//element(*, " + EntityTypes.ENTITY_ENTITY + ")";
+ if (entityType != null) {
+ int indexColumn = entityType.indexOf(':');
+ if (indexColumn > 0) {// JCR node type
+ xpathQueryStr = "//element(*, " + entityType + ") order by @jcr:created descending";
+ } else {
+ xpathQueryStr = entityType.contains(":") ? "//element(*, " + entityType + ")"
+ : "//element(*, " + EntityType.entity.get() + ")[@entity:type='" + entityType + "']";
+ }
+ } else {
+ xpathQueryStr = "//element(*, " + EntityType.entity.get() + ")";
+ }