mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
#125 - ENH: Add support for query returning a List of single Attribute type
This commit is contained in:
1 parent
9a5cb242ce
commit
1be30f1671
25 files changed
+716
-218
No files matched your search
@@ -192,6 +192,8 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
*/
|
||||
private boolean forUpdate;
|
||||
|
||||
private boolean singleAttribute;
|
||||
|
||||
/**
|
||||
* Set to true if this query has been tuned by autoTune.
|
||||
*/
|
||||
@@ -534,6 +536,26 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
select(beanDescriptor.getIdBinder().getIdProperty());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSingleAttribute() {
|
||||
this.singleAttribute = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this is a single attribute query.
|
||||
*/
|
||||
public boolean isSingleAttribute() {
|
||||
return singleAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the Id should be included in the query.
|
||||
*/
|
||||
@Override
|
||||
public boolean isWithId() {
|
||||
return !distinct && !singleAttribute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NaturalKeyBindParam getNaturalKeyBindParam() {
|
||||
NaturalKeyBindParam namedBind = null;
|
||||
@@ -1133,6 +1155,11 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
return (Map<K, T>) findMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <A> List<A> findSingleAttributeList() {
|
||||
return (List<A>)server.findSingleAttributeList(this, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T findUnique() {
|
||||
return server.findUnique(this, null);
|
||||
|
||||
Reference in new issue
Block a user