Package play.db.jpa
Class GenericModel.JPAQuery
java.lang.Object
play.db.jpa.GenericModel.JPAQuery
- Enclosing class:
- GenericModel
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBind a JPQL named parameter to the current query.<T> List<T>fetch()Retrieve all results of the query<T> List<T>fetch(int max) Retrieve results of the query<T> List<T>fetch(int page, int length) Retrieve a page of result<T> Tfirst()from(int position) Set the position to startsetParameter(String name, Object param) Set a named parameter for this query.
-
Field Details
-
query
public jakarta.persistence.Query query -
sq
-
-
Constructor Details
-
JPAQuery
-
JPAQuery
public JPAQuery(jakarta.persistence.Query query)
-
-
Method Details
-
first
@Nullable public <T> T first() -
bind
Bind a JPQL named parameter to the current query. Careful, this will also bind count results. This means that Integer get transformed into long so hibernate can do the right thing. Use the setParameter if you just want to set parameters.- Parameters:
name- name of the objectparam- current query- Returns:
- The query
-
setParameter
Set a named parameter for this query.- Parameters:
name- Parameter nameparam- The given parameters- Returns:
- The query
-
fetch
Retrieve all results of the query- Type Parameters:
T- the type of the entity- Returns:
- A list of entities
-
fetch
Retrieve results of the query- Type Parameters:
T- The entity class- Parameters:
max- Max results to fetch- Returns:
- A list of entities
-
from
Set the position to start- Parameters:
position- Position of the first element- Returns:
- A new query
-
fetch
Retrieve a page of result- Type Parameters:
T- The entity class- Parameters:
page- Page number (start at 1)length- (page length)- Returns:
- a list of entities
-