public class JpqlStatementFactoryImpl extends AbstractStatementFactory implements JpqlStatementFactory
Modifier and Type | Field and Description |
---|---|
private GenericPojoBeanMapper |
beanMapper |
private JpqlDialect |
dialect |
private javax.persistence.EntityManager |
entityManager |
Constructor and Description |
---|
JpqlStatementFactoryImpl()
The constructor.
|
JpqlStatementFactoryImpl(javax.persistence.EntityManager entityManager)
The constructor.
|
JpqlStatementFactoryImpl(javax.persistence.EntityManager entityManager,
JpqlDialect dialect)
The constructor.
|
JpqlStatementFactoryImpl(JpqlDialect dialect)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
(package private) static void |
assignParameters(javax.persistence.Query query,
AbstractStatement<?,?> statement,
Long firstResult,
Integer maxResults) |
<E> JpqlDeleteStatement<E> |
deleteFrom(EntityAlias<E> alias)
Creates a regular
DeleteStatement (DELETE FROM alias.source [AS alias.name] ... ). |
protected GenericPojoBeanMapper |
getBeanMapper() |
protected javax.persistence.EntityManager |
getEntityManager() |
<E> JpqlSelectStatement<E> |
selectFrom(EntityAlias<?> alias,
Class<E> toClass,
PropertyPath<?>... constructorArgs)
Creates
SelectStatement for a projection to a transfer-object having an according constructor. |
JpqlSelectStatement<Object[]> |
selectFrom(EntityAlias<?> alias,
PropertyPath<?>... paths)
Creates
SelectStatement for a tuple of the given {paths (
{@code SELECT path1, path2, ... |
<E> JpqlSelectStatement<E> |
selectFrom(EntityAlias<E> alias)
Creates a regular
SelectStatement (SELECT FROM alias.source [AS alias.name] ... ). |
void |
setBeanMapper(GenericPojoBeanMapper beanMapper) |
void |
setEntityManager(javax.persistence.EntityManager entityManager) |
<E> JpqlUpdateStatement<E> |
update(EntityAlias<E> alias)
Creates a regular
UpdateStatement (UPDATE alias.source [AS alias.name] ... ). |
createLogger, doInitialize, getLogger
doInitialized, getInitializationState, initialize
private javax.persistence.EntityManager entityManager
private JpqlDialect dialect
private GenericPojoBeanMapper beanMapper
public JpqlStatementFactoryImpl()
public JpqlStatementFactoryImpl(JpqlDialect dialect)
dialect
- the JpqlDialect
.public JpqlStatementFactoryImpl(javax.persistence.EntityManager entityManager)
entityManager
- the EntityManager
.public JpqlStatementFactoryImpl(javax.persistence.EntityManager entityManager, JpqlDialect dialect)
entityManager
- the EntityManager
.dialect
- the JpqlDialect
.public void setEntityManager(javax.persistence.EntityManager entityManager)
entityManager
- is the EntityManager
to inject.protected javax.persistence.EntityManager getEntityManager()
EntityManager
.@Inject public void setBeanMapper(GenericPojoBeanMapper beanMapper)
beanMapper
- is the GenericPojoBeanMapper
to Inject
.protected GenericPojoBeanMapper getBeanMapper()
GenericPojoBeanMapper
.public <E> JpqlSelectStatement<E> selectFrom(EntityAlias<E> alias)
FeatureSelect
SelectStatement
(SELECT FROM alias.source [AS alias.name] ...
).selectFrom
in interface JpqlStatementFactory
selectFrom
in interface FeatureSelect
E
- the generic type of the entity to select.alias
- the EntityAlias
to select from.SelectStatement
.public JpqlSelectStatement<Object[]> selectFrom(EntityAlias<?> alias, PropertyPath<?>... paths)
FeatureSelect
SelectStatement
for a tuple of the given {paths
(
SELECT path1, path2, ... FROM alias.source [AS alias.name] ...
).selectFrom
in interface JpqlStatementFactory
selectFrom
in interface FeatureSelect
alias
- the EntityAlias
to select from.paths
- the PropertyPath
s to select.SelectStatement
.public <E> JpqlSelectStatement<E> selectFrom(EntityAlias<?> alias, Class<E> toClass, PropertyPath<?>... constructorArgs)
FeatureSelect
SelectStatement
for a projection to a transfer-object having an according constructor. In JPA this
is called a constructor query (
SELECT NEW package.Classname(arg1, arg2, ...) FROM alias.source [AS alias.name] ...
). If not natively
supported this is implemented as a projection based on a tuple
selection
.selectFrom
in interface JpqlStatementFactory
selectFrom
in interface FeatureSelect
E
- the generic type of the transfer-object to select.alias
- the EntityAlias
to select from.toClass
- the transfer-object to use. Will be instantiated via the Constructor
matching to the value
types of the constructorArgs
.constructorArgs
- the selection paths (or aggregate expressions).SelectStatement
.public <E> JpqlDeleteStatement<E> deleteFrom(EntityAlias<E> alias)
FeatureDelete
DeleteStatement
(DELETE FROM alias.source [AS alias.name] ...
).deleteFrom
in interface JpqlStatementFactory
deleteFrom
in interface FeatureDelete
E
- the generic type of the entity to delete from.alias
- the EntityAlias
to delete from.DeleteStatement
.public <E> JpqlUpdateStatement<E> update(EntityAlias<E> alias)
FeatureUpdate
UpdateStatement
(UPDATE alias.source [AS alias.name] ...
).update
in interface JpqlStatementFactory
update
in interface FeatureUpdate
E
- the generic type of the entity to update.alias
- the EntityAlias
to update.UpdateStatement
.static void assignParameters(javax.persistence.Query query, AbstractStatement<?,?> statement, Long firstResult, Integer maxResults)
Copyright © 2001–2016 mmm-Team. All rights reserved.