Internal Website Search

1-50 of 137 results

JPA Query API

, which was the only interface available for representing queries in JPA 1, and the new TypedQuery interface that was introduced in JPA 2. The TypedQuery interface extends the Query interface. In JPA 2 the Query interface ... . When a more specific result type is expected queries should usually use the TypedQuery interface. It is easier to run

Running JPA Queries

other case. Similarly, the TypedQuery interface defines the following methods: TypedQuery .getSingleResult - for use when exactly one result object is expected. TypedQuery .getResultList - for general use in any ... : TypedQuery query = em. createQuery ("SELECT c FROM Country c", Country.class); List results = query

Query Parameters in JPA

getCountryByName( EntityManager em, String name) { TypedQuery query = em. createQuery ( "SELECT c FROM ... method supports method chaining (by returning the same TypedQuery instance on which it was invoked ... ( EntityManager em, String name) { TypedQuery query = em. createQuery ( "SELECT c FROM Country c

JPA Criteria API Queries

expression. A  CriteriaQuery instance is equivalent to a JPQL string and not to a TypedQuery instance. Therefore, running the query still requires a  TypedQuery instance: TypedQuery query = em ... as follows: TypedQuery query =      em. createQuery ("SELECT c FROM Country c

javax.persistence.TypedQuery

JPA Interface TypedQuery Type Parameters: - query result type Super Interfaces: Query Interface ... - JPA Queries (JPQL / Criteria) explains how to use TypedQuery . Public Methods int executeUpdate ... TypedQuery setFirstResult (int startPosition) Set the position of the first result to retrieve

SELECT clause (JPQL / Criteria API)

, the following query returns Country objects that become managed by the EntityManager em : TypedQuery query ... of the above query are received as a list of String values: TypedQuery query = em. createQuery ( "SELECT ... this query and processing the results: TypedQuery query = em. createQuery ( "SELECT c.name, c.capital

JPA Queries

Queries are represented in JPA by the Query and TypedQuery interfaces: The JPA Query API ... these interfaces to build and run JPQL queries. The TypedQuery interface (or alternatively the older Query ... a TypedQuery or a Query instance. Building a dynamic query using the criteria API is managed by the 

TypedQuery implementation problems

Hi everyone, I'm having problems. I have implemented TypedQuery in a module of my web system and everything works perfectly. but when making another module and implementing TypedQuery ... ; TypedQuery query = em.createQuery( "select new com.javatmp.module.accounting.entity.Account(" + "acct

TypedQuery.setFirstResult(startPosition) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setFirstResult (   int startPosition ) Set the position of the first result to retrieve. Parameters: startPosition - position of the first result, numbered from 0 Return: the same query instance Throws: IllegalArgumentException - if the argument is negative Since: JPA 2.0

TypedQuery.setMaxResults(maxResult) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setMaxResults (   int maxResult ) Set the maximum number of results to retrieve. Parameters: maxResult - maximum number of results to retrieve Return: the same query instance Throws: IllegalArgumentException - if the argument is negative Since: JPA 2.0

TypedQuery.setParameter(param,value,temporalType) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setParameter (    Parameter  param,    Date value,     TemporalType  temporalType ) Bind an instance of java.util.Date to a Parameter object. Parameters: param - parameter object value

TypedQuery.setParameter(name,value) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setParameter (   String name,    Object value ) Bind an argument value to a named parameter. Parameters: name - parameter name value - parameter value Return: the same query instance Throws

TypedQuery.setParameter(param,value,temporalType) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setParameter (    Parameter  param,    Calendar value,     TemporalType  temporalType ) Bind an instance of java.util.Calendar to a Parameter object. Parameters: param - parameter object

TypedQuery.setParameter(param,value) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setParameter (    Parameter  param,    T value ) Bind the value of a Parameter object. Parameters: param - parameter object value - parameter value Return: the same query instance Throws

TypedQuery.setHint(hintName,value) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setHint (   String hintName,    Object value ) Set a query property or hint. The hints elements may be used to specify query properties and hints. Properties defined by this specification must be observed by

TypedQuery.setParameter(position,value,temporalType) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setParameter (   int position,    Calendar value,     TemporalType  temporalType ) Bind an instance of java.util.Calendar to a positional parameter. Parameters: position - position value

TypedQuery.setParameter(position,value,temporalType) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setParameter (   int position,    Date value,     TemporalType  temporalType ) Bind an instance of java.util.Date to a positional parameter. Parameters: position - position value

TypedQuery.setParameter(position,value) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setParameter (   int position,    Object value ) Bind an argument value to a positional parameter. Parameters: position - position value - parameter value Return: the same query instance Throws

TypedQuery.setParameter(name,value,temporalType) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setParameter (   String name,    Date value,     TemporalType  temporalType ) Bind an instance of java.util.Date to a named parameter. Parameters: name - parameter name value - parameter

TypedQuery.setParameter(name,value,temporalType) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setParameter (   String name,    Calendar value,     TemporalType  temporalType ) Bind an instance of java.util.Calendar to a named parameter. Parameters: name - parameter name value

TypedQuery.setLockMode(lockMode) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setLockMode (    LockModeType  lockMode ) Set the lock mode type to be used for the query execution. Parameters: lockMode - lock mode Return: the same query instance Throws: IllegalStateException - if the query is found not

TypedQuery.setFlushMode(flushMode) - JPA Method

JPA Method in javax.persistence. TypedQuery TypedQuery setFlushMode (    FlushModeType  flushMode ) Set the flush mode type to be used for the query execution. The flush mode type applies to the query regardless of the flush mode type in use for the entity manager. Parameters

TypedQuery.getSingleResult() - JPA Method

JPA Method in javax.persistence. TypedQuery X getSingleResult () Execute a SELECT query that returns a single result. Return: the result Throws: NoResultException - if there is no result NonUniqueResultException - if more than one result IllegalStateException - if called for a Java Persistence

TypedQuery.getResultList() - JPA Method

JPA Method in javax.persistence. TypedQuery List getResultList () Execute a SELECT query and return the query results as a typed List. Return: a list of the results Throws: IllegalStateException - if called for a Java Persistence query language UPDATE or DELETE statement QueryTimeoutException

TypedQuery.getResultStream() - JPA Method

JPA Method in javax.persistence. TypedQuery Stream getResultStream () Execute a SELECT query and return the query results as a typed java.util.stream.Stream . By default this method delegates to getResultList().stream() , however persistence provider may choose to override this method to provide

JPA Named Queries

at Runtime Named queries are represented at runtime by the same Query and TypedQuery interfaces ... receives a query name and a result type and returns a TypedQuery instance: TypedQuery query = em

Setting and Tuning of JPA Queries

The  Query and  TypedQuery interfaces define various setting and tuning methods that may affect query execution if invoked before a query is run using getResultList or getSingleResult ... in Query and TypedQuery support method chaining (by returning the query object

FROM clause (JPQL / Criteria API)

iteration: TypedQuery query =       em. createQuery ("SELECT c FROM Country c

Online Backup

; TypedQuery backupQuery =     em.createQuery("objectdb backup", Thread.class);  

JBOSS AS7 7.1.1 - Entity not persisted and createNamedQuery fire exception

.persistence.PersistenceContext; import javax.persistence. TypedQuery ; import javax.persistence ... ( "ManagedType Guest not found"  );   // NamedQuery does not work   // TypedQuery query = this.em.createNamedQuery( "Guest.getAll", Guest.class );   TypedQuery query = this.em

javax.persistence.EntityManager

. See Also: Query TypedQuery CriteriaQuery PersistenceContext StoredProcedureQuery Since: JPA 1.0 The Database ... on the EntityManager instance and any Query , TypedQuery , and StoredProcedureQuery objects obtained from ... string is found to be invalid Since: JPA 1.0 TypedQuery createNamedQuery (String name, Class

Step 3: Define an EJB Session Bean

.persistence.PersistenceContext; import javax.persistence. TypedQuery ; @Stateless public class GuestDao ... getAllGuests() { TypedQuery query = em.createQuery( "SELECT g FROM Guest g ORDER BY g.id", Guest.class

Step 3: Define a Spring DAO Component

.persistence. TypedQuery ; import org.springframework.stereotype.Component; import org.springframework ... () { TypedQuery query = em.createQuery( "SELECT g FROM Guest g ORDER BY g.id", Guest.class); return

Step 3: Define a Spring DAO Component

javax.persistence. TypedQuery ; import org.springframework.stereotype.Component; import org ... getAllGuests() { TypedQuery query = em.createQuery( "SELECT g FROM Guest g ORDER BY g.id", Guest.class); return

Step 3: Define an EJB Session Bean

.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence. TypedQuery ... ); } // Retrieves all the guests: public List getAllGuests() { TypedQuery query = em.createQuery( "SELECT g FROM

Object as parameter results in exception

; TypedQuery q = getEntityManager().createQuery(c);   List resultList = q.getResultList();   ... "), company.getId())));   TypedQuery q = getEntityManager().createQuery(c);   List resultList ... efficiency please consider: Building the query (the CriteriaQuery and the TypedQuery

Query results are not up to date for entities, not primitives

TypedQuerys . I just realized that the data retrieving up to date  if I do not use the generic ... .personID == :personID")   I really need to use my generic functions to build the typedquerys ... are done perfectly well. The problem is in the fact that I'm building the typedquerys through use of generic

EntityManager.createNamedQuery(name,resultClass) - JPA Method

JPA Method in javax.persistence.EntityManager TypedQuery createNamedQuery (   String name,    Class  resultClass ) Create an instance of TypedQuery for executing a Java Persistence query language named query. The select list of the query must contain

javax.persistence.NonUniqueResultException

.getSingleResult() or TypedQuery .getSingleResult() is executed on a query and there is more than one result ... , to be marked for rollback. See Also: Query.getSingleResult () TypedQuery .getSingleResult () Since: JPA 1.0

javax.persistence.NoResultException

TypedQuery .getSingleResult() is executed on a query and there is no result to return. This exception ... . See Also: Query.getSingleResult () TypedQuery .getSingleResult () Since: JPA 1.0 Public Constructors

EntityManager.createQuery(criteriaQuery) - JPA Method

JPA Method in javax.persistence.EntityManager TypedQuery createQuery (    CriteriaQuery  criteriaQuery ) Create an instance of TypedQuery for executing a criteria query. Parameters: criteriaQuery - a criteria query object Return: the new query instance Throws

javax.persistence.FlushModeType

is set on the Query or javax.persistence. TypedQuery object, or if the flush mode setting ... TypedQuery object, the persistence provider is responsible for ensuring that all updates to the state

EntityManager.createQuery(qlString,resultClass) - JPA Method

JPA Method in javax.persistence.EntityManager TypedQuery createQuery (   String qlString,    Class  resultClass ) Create an instance of TypedQuery for executing a Java Persistence query language statement. The select list of the query must contain only a single

javax.persistence.PessimisticLockScope

, and TypedQuery interfaces that allow lock modes to be specified or used with the NamedQuery annotation

javax.persistence.LockModeType

.setLockMode() or TypedQuery .setLockMode() method. Lock modes can be used to specify either optimistic or

EntityManagerFactory.addNamedQuery(name,query) - JPA Method

: name - name for the query query - Query, TypedQuery , or StoredProcedureQuery object Since: JPA 2.1

javax.persistence.EntityManagerFactory

definition is replaced. Parameters: name - name for the query query - Query, TypedQuery , or

javax.persistence.Query

JPA Interface Query Interface used to control query execution. See Also: TypedQuery StoredProcedureQuery Parameter Since: JPA 1.0 Chapter 4 - JPA Queries (JPQL / Criteria) explains how to use Query . Public Methods int executeUpdate () Execute an update or delete statement. Return: the number

javax.persistence.Parameter

JPA Interface Parameter Type Parameters: - the type of the parameter Type for query parameter objects. See Also: Query TypedQuery Since: JPA 2.0 Chapter 4 - JPA Queries (JPQL / Criteria) explains how to use Parameter . Public Methods String getName () Return the parameter name, or null

EntityManager.close() - JPA Method

JPA Method in javax.persistence.EntityManager void close () Close an application-managed entity manager. After the close method has been invoked, all methods on the EntityManager instance and any Query , TypedQuery , and StoredProcedureQuery objects obtained from it will throw