|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectome.tools.hibernate.QueryBuilder
public class QueryBuilder
Very thin wrapper around a StringBuilder
to generate HQL queries.
This comes from the very real deficiencies of the Criteria API when trying to
implement ome.services.SearchBean.
Note: It is the responsibility of each method here to end with a blank space,
meaning that each method may also begin without one.
This class is NOT thread-safe.
Constructor Summary | |
---|---|
QueryBuilder()
|
|
QueryBuilder(int size)
|
Method Summary | |
---|---|
QueryBuilder |
and(String str)
Appends "and" plus your string unless this is the first where-spec in which case it is simply appended. |
QueryBuilder |
append(String string)
Simple delegate method to allow appending arbitrary strings. |
QueryBuilder |
appendSpace()
|
void |
filter(String string,
ome.parameters.Filter filter)
|
QueryBuilder |
from(String type,
String alias)
|
QueryBuilder |
join(String path,
String alias,
boolean outer,
boolean fetch)
|
QueryBuilder |
or(String str)
Appends "or" plus your string unless this is the first where-spec in which case it is simply appended. |
QueryBuilder |
order(String path,
boolean ascending)
|
QueryBuilder |
param(String key,
Object o)
|
QueryBuilder |
paramList(String key,
Collection c)
|
void |
params(ome.parameters.Parameters params2)
|
org.hibernate.Query |
query(org.hibernate.Session session)
|
String |
queryString()
Returns the current query as a String. |
QueryBuilder |
select(String... selects)
|
void |
skipFrom()
|
void |
skipWhere()
|
QueryBuilder |
subselect(QueryBuilder subselect)
Appends the string representation of the QueryBuilder argument
inside of parentheses. |
void |
throwUsage()
|
String |
toString()
|
String |
unique_alias(String prefix)
Obtain a unique alias to be used in the SQL. |
QueryBuilder |
where()
Marks the end of all fetches by adding a "where" clause to the string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public QueryBuilder()
public QueryBuilder(int size)
Method Detail |
---|
public void throwUsage() throws ome.conditions.ApiUsageException
ome.conditions.ApiUsageException
public String unique_alias(String prefix)
prefix
- Not nullpublic QueryBuilder append(String string)
public QueryBuilder select(String... selects)
public QueryBuilder from(String type, String alias)
type
- alias
-
public QueryBuilder join(String path, String alias, boolean outer, boolean fetch)
public QueryBuilder where()
public QueryBuilder and(String str)
str
-
public QueryBuilder or(String str)
str
-
public QueryBuilder subselect(QueryBuilder subselect)
QueryBuilder
argument
inside of parentheses.
public QueryBuilder order(String path, boolean ascending)
public QueryBuilder param(String key, Object o)
public QueryBuilder paramList(String key, Collection c)
public org.hibernate.Query query(org.hibernate.Session session)
public QueryBuilder appendSpace()
public String queryString()
toString()
,
this method should return parseable HQL.
public String toString()
toString
in class Object
public void skipFrom()
public void skipWhere()
public void filter(String string, ome.parameters.Filter filter)
public void params(ome.parameters.Parameters params2)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Version: Beta-4.2.0-r7571-b29
Copyright © 2009 The University of Dundee. All Rights Reserved.