/** * Get the first result from the query that is not marked as read only, * causing the query to be run. * * @return the first writable result, or null if there are no results */ public Property<V> getFirstWritableResult() { List<Property<V>> results = getWritableResultList(); return results.isEmpty() ? null : results.get(0); }
/** * Get the first result from the query that is not marked as read only, causing the query to be run. * * @return the first writable result, or null if there are no results */ public Property<V> getFirstWritableResult() { List<Property<V>> results = getWritableResultList(); return results.isEmpty() ? null : results.get(0); }
/** * Get the first result from the query that is not marked as read only, causing the query to be run. * * @return the first writable result, or null if there are no results */ public Property<V> getFirstWritableResult() { List<Property<V>> results = getWritableResultList(); return results.isEmpty() ? null : results.get(0); }
/** * Get a single result from the query that is not marked as read only, causing the query to be run. An exception is * thrown if the query does not return exactly one result. * * @return the single writable result * * @throws RuntimeException if the query does not return exactly one result */ public Property<V> getWritableSingleResult() { List<Property<V>> results = getWritableResultList(); if (results.size() == 1) { return results.get(0); } else if (results.isEmpty()) { throw new RuntimeException( "Expected one property match, but the criteria did not match any properties on " + targetClass.getName()); } else { throw new RuntimeException("Expected one property match, but the criteria matched " + results.size() + " properties on " + targetClass.getName()); } }
/** * Get a single result from the query that is not marked as read only, causing the query to be run. An exception is * thrown if the query does not return exactly one result. * * @return the single writable result * * @throws RuntimeException if the query does not return exactly one result */ public Property<V> getWritableSingleResult() { List<Property<V>> results = getWritableResultList(); if (results.size() == 1) { return results.get(0); } else if (results.isEmpty()) { throw new RuntimeException( "Expected one property match, but the criteria did not match any properties on " + targetClass.getName()); } else { throw new RuntimeException("Expected one property match, but the criteria matched " + results.size() + " properties on " + targetClass.getName()); } }
/** * Get a single result from the query that is not marked as read only, * causing the query to be run. An exception is thrown if the query does not * return exactly one result. * * @return the single writable result * @throws RuntimeException if the query does not return exactly one result */ public Property<V> getWritableSingleResult() { List<Property<V>> results = getWritableResultList(); if (results.size() == 1) { return results.get(0); } else if (results.isEmpty()) { throw new RuntimeException( "Expected one property match, but the criteria did not match any properties on " + targetClass.getName()); } else { throw new RuntimeException("Expected one property match, but the criteria matched " + results.size() + " properties on " + targetClass.getName()); } }