mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
Improve javadocs for querydsl-jpa and querydsl-jpa-codegen
This commit is contained in:
parent
59460d05cb
commit
91da605eab
@ -44,7 +44,7 @@ import com.querydsl.core.util.Annotations;
|
||||
import com.querydsl.core.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* AbstractDomainExporter is a common supertype for DomainExporters
|
||||
* {@code AbstractDomainExporter} is a common supertype for domain exporters
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableList;
|
||||
* @author tiwe
|
||||
*
|
||||
*/
|
||||
public final class Constants {
|
||||
final class Constants {
|
||||
|
||||
public static final List<String> keywords = ImmutableList.of(
|
||||
"ABS","ALL","AND","ANY","AS","ASC","AVG","BETWEEN",
|
||||
|
||||
@ -13,13 +13,20 @@
|
||||
*/
|
||||
package com.querydsl.jpa.codegen;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.mapping.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.mysema.codegen.model.SimpleType;
|
||||
import com.mysema.codegen.model.Type;
|
||||
import com.mysema.codegen.model.TypeCategory;
|
||||
@ -27,14 +34,9 @@ import com.querydsl.codegen.EntityType;
|
||||
import com.querydsl.codegen.Property;
|
||||
import com.querydsl.codegen.SerializerConfig;
|
||||
import com.querydsl.codegen.SimpleSerializerConfig;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.mapping.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* HibernateDomainExporter exports Hibernate XML configuration files to Querydsl expression types
|
||||
* {@code HibernateDomainExporter} exports Hibernate XML configuration files to Querydsl expression types
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
@ -48,8 +50,8 @@ public class HibernateDomainExporter extends AbstractDomainExporter{
|
||||
/**
|
||||
* Create a new HibernateDomainExporter instance
|
||||
*
|
||||
* @param targetFolder
|
||||
* @param configuration
|
||||
* @param targetFolder target folder
|
||||
* @param configuration configuration
|
||||
*/
|
||||
public HibernateDomainExporter(File targetFolder, Configuration configuration) {
|
||||
this("Q", "", targetFolder, SimpleSerializerConfig.DEFAULT, configuration,
|
||||
@ -59,9 +61,9 @@ public class HibernateDomainExporter extends AbstractDomainExporter{
|
||||
/**
|
||||
* Create a new HibernateDomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param targetFolder
|
||||
* @param configuration
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param targetFolder target folder
|
||||
* @param configuration configuration
|
||||
*/
|
||||
public HibernateDomainExporter(String namePrefix, File targetFolder, Configuration configuration) {
|
||||
this(namePrefix, "", targetFolder, SimpleSerializerConfig.DEFAULT, configuration,
|
||||
@ -71,10 +73,10 @@ public class HibernateDomainExporter extends AbstractDomainExporter{
|
||||
/**
|
||||
* Create a new HibernateDomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param targetFolder
|
||||
* @param configuration
|
||||
* @param charset
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param targetFolder target folder
|
||||
* @param configuration configuration
|
||||
* @param charset charset (default: system charset)
|
||||
*/
|
||||
public HibernateDomainExporter(String namePrefix, File targetFolder, Configuration configuration,
|
||||
Charset charset) {
|
||||
@ -84,10 +86,10 @@ public class HibernateDomainExporter extends AbstractDomainExporter{
|
||||
/**
|
||||
* Create a new HibernateDomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param nameSuffix
|
||||
* @param targetFolder
|
||||
* @param configuration
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param nameSuffix name suffix (default: empty)
|
||||
* @param targetFolder target folder
|
||||
* @param configuration configuration
|
||||
*/
|
||||
public HibernateDomainExporter(String namePrefix, String nameSuffix, File targetFolder,
|
||||
Configuration configuration) {
|
||||
@ -98,10 +100,10 @@ public class HibernateDomainExporter extends AbstractDomainExporter{
|
||||
/**
|
||||
* Create a new HibernateDomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param targetFolder
|
||||
* @param serializerConfig
|
||||
* @param configuration
|
||||
* @param namePrefix name prefix (default Q)
|
||||
* @param targetFolder target golder
|
||||
* @param serializerConfig serializer config
|
||||
* @param configuration configuration
|
||||
*/
|
||||
public HibernateDomainExporter(String namePrefix, File targetFolder,
|
||||
SerializerConfig serializerConfig, Configuration configuration) {
|
||||
@ -111,11 +113,11 @@ public class HibernateDomainExporter extends AbstractDomainExporter{
|
||||
/**
|
||||
* Create a new HibernateDomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param targetFolder
|
||||
* @param serializerConfig
|
||||
* @param configuration
|
||||
* @param charset
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param targetFolder target folder
|
||||
* @param serializerConfig serializer config
|
||||
* @param configuration configuration
|
||||
* @param charset charset (default: system charset)
|
||||
*/
|
||||
public HibernateDomainExporter(String namePrefix, File targetFolder,
|
||||
SerializerConfig serializerConfig, Configuration configuration, Charset charset) {
|
||||
@ -125,12 +127,12 @@ public class HibernateDomainExporter extends AbstractDomainExporter{
|
||||
/**
|
||||
* Create a new HibernateDomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param nameSuffix
|
||||
* @param targetFolder
|
||||
* @param serializerConfig
|
||||
* @param configuration
|
||||
* @param charset
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param nameSuffix name suffix (default: empty)
|
||||
* @param targetFolder target folder
|
||||
* @param serializerConfig serializer config
|
||||
* @param configuration configuration
|
||||
* @param charset charset (default: system charset)
|
||||
*/
|
||||
public HibernateDomainExporter(String namePrefix, String nameSuffix, File targetFolder,
|
||||
SerializerConfig serializerConfig, Configuration configuration, Charset charset) {
|
||||
|
||||
@ -13,15 +13,18 @@
|
||||
*/
|
||||
package com.querydsl.jpa.codegen;
|
||||
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.metamodel.*;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.AnnotatedElement;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.metamodel.*;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mysema.codegen.model.SimpleType;
|
||||
import com.mysema.codegen.model.Type;
|
||||
@ -30,109 +33,108 @@ import com.querydsl.codegen.EntityType;
|
||||
import com.querydsl.codegen.Property;
|
||||
import com.querydsl.codegen.SerializerConfig;
|
||||
import com.querydsl.codegen.SimpleSerializerConfig;
|
||||
import org.hibernate.MappingException;
|
||||
|
||||
/**
|
||||
* JPADomainExporter exports JPA 2 metamodels to Querydsl expression types
|
||||
* {@code JPADomainExporter} exports JPA 2 metamodels to Querydsl expression types
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
*/
|
||||
public class JPADomainExporter extends AbstractDomainExporter {
|
||||
|
||||
private final Metamodel configuration;
|
||||
private final Metamodel metamodel;
|
||||
|
||||
/**
|
||||
* Create a new JPADomainExporter instance
|
||||
*
|
||||
* @param targetFolder
|
||||
* @param configuration
|
||||
* @param targetFolder target folder
|
||||
* @param metamodel metamodel
|
||||
*/
|
||||
public JPADomainExporter(File targetFolder, Metamodel configuration) {
|
||||
this("Q", "", targetFolder, SimpleSerializerConfig.DEFAULT, configuration,
|
||||
public JPADomainExporter(File targetFolder, Metamodel metamodel) {
|
||||
this("Q", "", targetFolder, SimpleSerializerConfig.DEFAULT, metamodel,
|
||||
Charset.defaultCharset());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new JPADomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param targetFolder
|
||||
* @param configuration
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param targetFolder target folder
|
||||
* @param metamodel metamodel
|
||||
*/
|
||||
public JPADomainExporter(String namePrefix, File targetFolder, Metamodel configuration) {
|
||||
this(namePrefix, "", targetFolder, SimpleSerializerConfig.DEFAULT, configuration,
|
||||
public JPADomainExporter(String namePrefix, File targetFolder, Metamodel metamodel) {
|
||||
this(namePrefix, "", targetFolder, SimpleSerializerConfig.DEFAULT, metamodel,
|
||||
Charset.defaultCharset());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new JPADomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param targetFolder
|
||||
* @param configuration
|
||||
* @param charset
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param targetFolder target folder
|
||||
* @param metamodel metamodel
|
||||
* @param charset charset (default: system charset)
|
||||
*/
|
||||
public JPADomainExporter(String namePrefix, File targetFolder, Metamodel configuration,
|
||||
public JPADomainExporter(String namePrefix, File targetFolder, Metamodel metamodel,
|
||||
Charset charset) {
|
||||
this(namePrefix, "", targetFolder, SimpleSerializerConfig.DEFAULT, configuration, charset);
|
||||
this(namePrefix, "", targetFolder, SimpleSerializerConfig.DEFAULT, metamodel, charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new JPADomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param nameSuffix
|
||||
* @param targetFolder
|
||||
* @param configuration
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param nameSuffix name suffix
|
||||
* @param targetFolder target folder
|
||||
* @param metamodel metamodel
|
||||
*/
|
||||
public JPADomainExporter(String namePrefix, String nameSuffix, File targetFolder,
|
||||
Metamodel configuration) {
|
||||
this(namePrefix, nameSuffix, targetFolder, SimpleSerializerConfig.DEFAULT, configuration,
|
||||
Metamodel metamodel) {
|
||||
this(namePrefix, nameSuffix, targetFolder, SimpleSerializerConfig.DEFAULT, metamodel,
|
||||
Charset.defaultCharset());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new JPADomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param targetFolder
|
||||
* @param serializerConfig
|
||||
* @param configuration
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param targetFolder target folder
|
||||
* @param serializerConfig serializer config
|
||||
* @param metamodel metamodel
|
||||
*/
|
||||
public JPADomainExporter(String namePrefix, File targetFolder,
|
||||
SerializerConfig serializerConfig, Metamodel configuration) {
|
||||
this(namePrefix, "", targetFolder, serializerConfig, configuration, Charset.defaultCharset());
|
||||
SerializerConfig serializerConfig, Metamodel metamodel) {
|
||||
this(namePrefix, "", targetFolder, serializerConfig, metamodel, Charset.defaultCharset());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new JPADomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param targetFolder
|
||||
* @param serializerConfig
|
||||
* @param configuration
|
||||
* @param charset
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param targetFolder target folder
|
||||
* @param serializerConfig serializer config
|
||||
* @param metamodel metamodel
|
||||
* @param charset charset (default: system charset)
|
||||
*/
|
||||
public JPADomainExporter(String namePrefix, File targetFolder,
|
||||
SerializerConfig serializerConfig, Metamodel configuration, Charset charset) {
|
||||
this(namePrefix, "", targetFolder, serializerConfig, configuration, charset);
|
||||
SerializerConfig serializerConfig, Metamodel metamodel, Charset charset) {
|
||||
this(namePrefix, "", targetFolder, serializerConfig, metamodel, charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new JPADomainExporter instance
|
||||
*
|
||||
* @param namePrefix
|
||||
* @param nameSuffix
|
||||
* @param targetFolder
|
||||
* @param serializerConfig
|
||||
* @param configuration
|
||||
* @param charset
|
||||
* @param namePrefix name prefix (default: Q)
|
||||
* @param nameSuffix name suffix (default: empty)
|
||||
* @param targetFolder target folder
|
||||
* @param serializerConfig serializer config
|
||||
* @param metamodel metamodel
|
||||
* @param charset charset (default: system charset)
|
||||
*/
|
||||
public JPADomainExporter(String namePrefix, String nameSuffix, File targetFolder,
|
||||
SerializerConfig serializerConfig, Metamodel configuration, Charset charset) {
|
||||
SerializerConfig serializerConfig, Metamodel metamodel, Charset charset) {
|
||||
super(namePrefix, nameSuffix, targetFolder, serializerConfig, charset);
|
||||
this.configuration = configuration;
|
||||
this.metamodel = metamodel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -140,7 +142,7 @@ public class JPADomainExporter extends AbstractDomainExporter {
|
||||
NoSuchMethodException {
|
||||
|
||||
Map<ManagedType<?>, EntityType> types = Maps.newHashMap();
|
||||
for (ManagedType<?> managedType : configuration.getManagedTypes()) {
|
||||
for (ManagedType<?> managedType : metamodel.getManagedTypes()) {
|
||||
if (managedType instanceof MappedSuperclassType) {
|
||||
types.put(managedType, createSuperType(managedType.getJavaType()));
|
||||
} else if (managedType instanceof javax.persistence.metamodel.EntityType) {
|
||||
|
||||
@ -12,7 +12,7 @@ import javax.persistence.metamodel.Metamodel;
|
||||
import com.querydsl.jpa.codegen.JPADomainExporter;
|
||||
|
||||
/**
|
||||
* AntJPADomainExporter exports JPA 2 metamodels to Querydsl expression types
|
||||
* {@code AntJPADomainExporter} exports JPA 2 metamodels to Querydsl expression types
|
||||
*
|
||||
* @author 200003548
|
||||
*/
|
||||
|
||||
@ -15,7 +15,10 @@ package com.querydsl.jpa;
|
||||
|
||||
import com.querydsl.core.types.Ops;
|
||||
|
||||
|
||||
/**
|
||||
* {@code BatooTemplates} extends {@link JPQLTemplates} with Batoo specific extensions
|
||||
*
|
||||
*/
|
||||
public class BatooTemplates extends JPQLTemplates {
|
||||
|
||||
public static final BatooTemplates DEFAULT = new BatooTemplates();
|
||||
|
||||
@ -26,7 +26,7 @@ import com.querydsl.sql.RelationalPath;
|
||||
import com.querydsl.sql.SQLOps;
|
||||
|
||||
/**
|
||||
* Conversions provides module specific projection conversion functionality
|
||||
* {@code Conversions} provides module specific projection conversion functionality
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -15,7 +15,9 @@ package com.querydsl.jpa;
|
||||
|
||||
import com.querydsl.core.types.Ops;
|
||||
|
||||
|
||||
/**
|
||||
* {@code DataNucleusTemplates} extends {@link JPQLTemplates} with DataNucleus specific extensions
|
||||
*/
|
||||
public class DataNucleusTemplates extends JPQLTemplates {
|
||||
|
||||
public static final DataNucleusTemplates DEFAULT = new DataNucleusTemplates();
|
||||
|
||||
@ -23,6 +23,8 @@ import com.mysema.commons.lang.IteratorAdapter;
|
||||
import com.querydsl.core.types.FactoryExpression;
|
||||
|
||||
/**
|
||||
* {@code DefaultQueryHandler} is the default implementation of the {@link QueryHandler} interface
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
*/
|
||||
|
||||
@ -29,11 +29,12 @@ import com.mysema.commons.lang.IteratorAdapter;
|
||||
import com.querydsl.core.types.FactoryExpression;
|
||||
|
||||
/**
|
||||
* {@code EclipseLinkHandler} is the {@link QueryHandler} implementation for EclipseLink
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
*/
|
||||
public class EclipseLinkHandler implements QueryHandler {
|
||||
class EclipseLinkHandler implements QueryHandler {
|
||||
|
||||
@Override
|
||||
public void addEntity(Query query, String alias, Class<?> type) {
|
||||
|
||||
@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.querydsl.core.types.Ops;
|
||||
|
||||
/**
|
||||
* EclipseLinkTemplates extends JPQLTemplates with EclipseLink specific extensions
|
||||
* {@code EclipseLinkTemplates} extends {@link JPQLTemplates} with EclipseLink specific extensions
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -20,7 +20,8 @@ import org.hibernate.transform.ResultTransformer;
|
||||
import com.querydsl.core.types.FactoryExpression;
|
||||
|
||||
/**
|
||||
* FactoryExpressionTransformer is a ResultTransformer implementation using FactoryExpression for transformation
|
||||
* {@code FactoryExpressionTransformer} is a ResultTransformer implementation using
|
||||
* FactoryExpression instances for transformation
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -25,7 +25,7 @@ import com.querydsl.core.types.Operator;
|
||||
import com.querydsl.core.types.Ops;
|
||||
|
||||
/**
|
||||
* HQLTemplates extends JPQLTemplates with Hibernate specific extensions
|
||||
* HQLTemplates extends {@link JPQLTemplates} with Hibernate specific extensions
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -28,10 +28,12 @@ import com.mysema.commons.lang.IteratorAdapter;
|
||||
import com.querydsl.core.types.FactoryExpression;
|
||||
|
||||
/**
|
||||
* {@code HibernateHandler} is the {@link QueryHandler} implementation for Hibernate
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
*/
|
||||
public class HibernateHandler implements QueryHandler {
|
||||
class HibernateHandler implements QueryHandler {
|
||||
|
||||
@Override
|
||||
public void addEntity(Query query, String alias, Class<?> type) {
|
||||
|
||||
@ -25,13 +25,13 @@ import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.SimplePath;
|
||||
|
||||
/**
|
||||
* JPACollectionAnyVisitor extends the {@link CollectionAnyVisitor} class with module specific
|
||||
* {@code JPACollectionAnyVisitor} extends the {@link CollectionAnyVisitor} class with module specific
|
||||
* extensions
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
*/
|
||||
public final class JPACollectionAnyVisitor extends CollectionAnyVisitor {
|
||||
class JPACollectionAnyVisitor extends CollectionAnyVisitor {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
||||
@ -21,10 +21,9 @@ import com.querydsl.core.types.Ops;
|
||||
import com.querydsl.core.types.dsl.ComparableExpression;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.types.dsl.StringExpression;
|
||||
import com.querydsl.sql.RelationalPath;
|
||||
|
||||
/**
|
||||
* JPAExpressions provides factory methods for JPQL specific operations
|
||||
* {@code JPAExpressions} provides factory methods for JPQL specific operations
|
||||
* elements.
|
||||
*
|
||||
* @author tiwe
|
||||
@ -35,9 +34,9 @@ public final class JPAExpressions {
|
||||
/**
|
||||
* Create a new detached JPQLQuery instance with the given projection
|
||||
*
|
||||
* @param expr
|
||||
* @param expr projection
|
||||
* @param <T>
|
||||
* @return
|
||||
* @return select(expr)
|
||||
*/
|
||||
public static <T> JPQLQuery<T> select(Expression<T> expr) {
|
||||
return new JPASubQuery<Void>().select(expr);
|
||||
@ -46,8 +45,8 @@ public final class JPAExpressions {
|
||||
/**
|
||||
* Create a new detached JPQLQuery instance with the given projection
|
||||
*
|
||||
* @param exprs
|
||||
* @return
|
||||
* @param exprs projection
|
||||
* @return select(exprs)
|
||||
*/
|
||||
public static JPQLQuery<Tuple> select(Expression<?>... exprs) {
|
||||
return new JPASubQuery<Void>().select(exprs);
|
||||
@ -56,9 +55,9 @@ public final class JPAExpressions {
|
||||
/**
|
||||
* Create a new detached JPQLQuery instance with the given projection
|
||||
*
|
||||
* @param expr
|
||||
* @param expr projection
|
||||
* @param <T>
|
||||
* @return
|
||||
* @return select(distinct expr)
|
||||
*/
|
||||
public static <T> JPQLQuery<T> selectDistinct(Expression<T> expr) {
|
||||
return new JPASubQuery<Void>().select(expr).distinct();
|
||||
@ -67,24 +66,26 @@ public final class JPAExpressions {
|
||||
/**
|
||||
* Create a new detached JPQLQuery instance with the given projection
|
||||
*
|
||||
* @param exprs
|
||||
* @return
|
||||
* @param exprs projection
|
||||
* @return select(distinct expr)
|
||||
*/
|
||||
public static JPQLQuery<Tuple> selectDistinct(Expression<?>... exprs) {
|
||||
return new JPASubQuery<Void>().select(exprs).distinct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new detached JPQLQuery instacne with the projection zero
|
||||
*
|
||||
* @return
|
||||
* @return select(0)
|
||||
*/
|
||||
public static JPQLQuery<Integer> selectZero() {
|
||||
return select(Expressions.ZERO);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new detached JPQLQuery instacne with the projection one
|
||||
*
|
||||
* @return
|
||||
* @return select(1)
|
||||
*/
|
||||
public static JPQLQuery<Integer> selectOne() {
|
||||
return select(Expressions.ONE);
|
||||
@ -93,49 +94,49 @@ public final class JPAExpressions {
|
||||
/**
|
||||
* Create a new detached JPQLQuery instance with the given projection
|
||||
*
|
||||
* @param expr
|
||||
* @param expr projection and source
|
||||
* @param <T>
|
||||
* @return
|
||||
* @return select(expr).from(expr)
|
||||
*/
|
||||
public static <T> JPQLQuery<T> selectFrom(EntityPath<T> expr) {
|
||||
return select(expr).from(expr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the avg(col) expression
|
||||
* Create a avg(col) expression
|
||||
*
|
||||
* @param col
|
||||
* @return
|
||||
* @param col collection
|
||||
* @return avg(col)
|
||||
*/
|
||||
public static <A extends Comparable<? super A>> ComparableExpression<A> avg(CollectionExpression<?,A> col) {
|
||||
return Expressions.comparableOperation((Class) col.getParameter(0), Ops.QuantOps.AVG_IN_COL, (Expression<?>) col);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the max(col) expression
|
||||
* Create a max(col) expression
|
||||
*
|
||||
* @param left
|
||||
* @return
|
||||
* @param left collection
|
||||
* @return max(col)
|
||||
*/
|
||||
public static <A extends Comparable<? super A>> ComparableExpression<A> max(CollectionExpression<?,A> left) {
|
||||
return Expressions.comparableOperation((Class) left.getParameter(0), Ops.QuantOps.MAX_IN_COL, (Expression<?>) left);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the min(col) expression
|
||||
* Create a min(col) expression
|
||||
*
|
||||
* @param left
|
||||
* @return
|
||||
* @param left collection
|
||||
* @return min(col)
|
||||
*/
|
||||
public static <A extends Comparable<? super A>> ComparableExpression<A> min(CollectionExpression<?,A> left) {
|
||||
return Expressions.comparableOperation((Class) left.getParameter(0), Ops.QuantOps.MIN_IN_COL, (Expression<?>) left);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type(path) expression
|
||||
* Create a type(path) expression
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
* @param path entity
|
||||
* @return type(path)
|
||||
*/
|
||||
public static StringExpression type(EntityPath<?> path) {
|
||||
return Expressions.stringOperation(JPQLOps.TYPE, path);
|
||||
|
||||
@ -19,7 +19,7 @@ import com.querydsl.core.types.*;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
|
||||
/**
|
||||
* JPAQueryBase is a base Query class for JPA queries
|
||||
* {@code JPAQueryBase} is a base Query class for JPA queries
|
||||
*
|
||||
* @author tiwe
|
||||
*/
|
||||
|
||||
@ -33,7 +33,7 @@ import com.querydsl.core.types.*;
|
||||
import com.querydsl.core.types.dsl.CollectionPathBase;
|
||||
|
||||
/**
|
||||
* JPAQueryMixin extends {@link QueryMixin} to support JPQL join construction
|
||||
* {@code JPAQueryMixin} extends {@link QueryMixin} to support JPQL join construction
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -16,6 +16,8 @@ package com.querydsl.jpa;
|
||||
import com.querydsl.core.types.Operator;
|
||||
|
||||
/**
|
||||
* {@code JPQLOps} provides JPQL specific operators
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
*/
|
||||
|
||||
@ -28,19 +28,20 @@ import com.querydsl.core.types.*;
|
||||
public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQLQuery<T>>, ExtendedSubQuery<T> {
|
||||
|
||||
/**
|
||||
* Set the sources of this query
|
||||
* Add sources to this query
|
||||
*
|
||||
* @param sources
|
||||
* @return
|
||||
* @param sources sources
|
||||
* @return the current object
|
||||
*/
|
||||
JPQLQuery<T> from(EntityPath<?>... sources);
|
||||
|
||||
/**
|
||||
* Add a query source
|
||||
*
|
||||
* @param target
|
||||
* @param alias
|
||||
* @param target collection
|
||||
* @param alias alias
|
||||
* @param <P>
|
||||
* @return
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> from(CollectionExpression<?,P> target, Path<P> alias);
|
||||
|
||||
@ -50,8 +51,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
*
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> innerJoin(EntityPath<P> target);
|
||||
|
||||
@ -59,9 +60,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a inner join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> innerJoin(EntityPath<P> target, Path<P> alias);
|
||||
|
||||
@ -70,8 +71,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> innerJoin(CollectionExpression<?, P> target);
|
||||
|
||||
@ -79,9 +80,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a inner join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> innerJoin(CollectionExpression<?,P> target, Path<P> alias);
|
||||
|
||||
@ -90,8 +91,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> innerJoin(MapExpression<?, P> target);
|
||||
|
||||
@ -99,9 +100,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a inner join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> innerJoin(MapExpression<?, P> target, Path<P> alias);
|
||||
|
||||
@ -110,8 +111,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> join(EntityPath<P> target);
|
||||
|
||||
@ -119,9 +120,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> join(EntityPath<P> target, Path<P> alias);
|
||||
|
||||
@ -130,16 +131,16 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> join(CollectionExpression<?,P> target);
|
||||
|
||||
/**
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> join(CollectionExpression<?,P> target, Path<P> alias);
|
||||
|
||||
@ -148,8 +149,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> join(MapExpression<?, P> target);
|
||||
|
||||
@ -157,9 +158,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> join(MapExpression<?, P> target, Path<P> alias);
|
||||
|
||||
@ -168,8 +169,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> leftJoin(EntityPath<P> target);
|
||||
|
||||
@ -177,9 +178,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a left join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> leftJoin(EntityPath<P> target, Path<P> alias);
|
||||
|
||||
@ -188,8 +189,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> leftJoin(CollectionExpression<?,P> target);
|
||||
|
||||
@ -197,9 +198,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a left join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> leftJoin(CollectionExpression<?,P> target, Path<P> alias);
|
||||
|
||||
@ -208,8 +209,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> leftJoin(MapExpression<?, P> target);
|
||||
|
||||
@ -217,9 +218,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a left join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> leftJoin(MapExpression<?, P> target, Path<P> alias);
|
||||
|
||||
@ -228,8 +229,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target targt
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> rightJoin(EntityPath<P> target);
|
||||
|
||||
@ -237,9 +238,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a right join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> rightJoin(EntityPath<P> target, Path<P> alias);
|
||||
|
||||
@ -248,8 +249,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> rightJoin(CollectionExpression<?,P> target);
|
||||
|
||||
@ -257,9 +258,9 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a right join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> rightJoin(CollectionExpression<?,P> target, Path<P> alias);
|
||||
|
||||
@ -268,8 +269,8 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Use fetchJoin() to add the fetchJoin parameter to this join.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @return
|
||||
* @param target target
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> rightJoin(MapExpression<?, P> target);
|
||||
|
||||
@ -277,17 +278,17 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Create a right join with the given target and alias.
|
||||
*
|
||||
* @param <P>
|
||||
* @param target
|
||||
* @param alias
|
||||
* @return
|
||||
* @param target target
|
||||
* @param alias alias
|
||||
* @return the current object
|
||||
*/
|
||||
<P> JPQLQuery<T> rightJoin(MapExpression<?, P> target, Path<P> alias);
|
||||
|
||||
/**
|
||||
* Add join conditions to the last added join
|
||||
*
|
||||
* @param condition
|
||||
* @return
|
||||
* @param condition join conditions
|
||||
* @return the current object
|
||||
*/
|
||||
JPQLQuery<T> on(Predicate... condition);
|
||||
|
||||
@ -297,13 +298,13 @@ public interface JPQLQuery<T> extends FetchableQuery<T, JPQLQuery<T>>, Query<JPQ
|
||||
* Mind that collection joins might result in duplicate rows and that "inner join fetchJoin"
|
||||
* will restrict your result set.
|
||||
*
|
||||
* @return
|
||||
* @return the current object
|
||||
*/
|
||||
JPQLQuery<T> fetchJoin();
|
||||
|
||||
/**
|
||||
* Add the "fetchJoin all properties" flag to the last defined join.
|
||||
* @return
|
||||
* @return the current object
|
||||
*/
|
||||
JPQLQuery<T> fetchAll();
|
||||
|
||||
|
||||
@ -31,74 +31,81 @@ public interface JPQLQueryFactory extends QueryFactory<JPQLQuery<?>> {
|
||||
/**
|
||||
* Create a new DELETE clause
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
* @param path entity to delete from
|
||||
* @return delete clause
|
||||
*/
|
||||
DeleteClause<?> delete(EntityPath<?> path);
|
||||
|
||||
/**
|
||||
* Create a new JPQLQuery instance with the given projection
|
||||
*
|
||||
* @param expr
|
||||
* @param expr projection
|
||||
* @param <T>
|
||||
* @return
|
||||
* @return select(expr)
|
||||
*/
|
||||
<T> JPQLQuery<T> select(Expression<T> expr);
|
||||
|
||||
/**
|
||||
* Create a new JPQLQuery instance with the given projection
|
||||
*
|
||||
* @param exprs
|
||||
* @return
|
||||
* @param exprs projection
|
||||
* @return select(exprs)
|
||||
*/
|
||||
JPQLQuery<Tuple> select(Expression<?>... exprs);
|
||||
|
||||
/**
|
||||
* Create a new JPQLQuery instance with the given projection
|
||||
*
|
||||
* @param expr
|
||||
* @param expr projection
|
||||
* @param <T>
|
||||
* @return
|
||||
* @return select(distinct expr)
|
||||
*/
|
||||
<T> JPQLQuery<T> selectDistinct(Expression<T> expr);
|
||||
|
||||
/**
|
||||
* Create a new JPQLQuery instance with the given projection
|
||||
*
|
||||
* @param exprs
|
||||
* @return
|
||||
* @param exprs projection
|
||||
* @return select(distinct exprs)
|
||||
*/
|
||||
JPQLQuery<Tuple> selectDistinct(Expression<?>... exprs);
|
||||
|
||||
/**
|
||||
* Create a new JPQLQuery instance with the projection one
|
||||
*
|
||||
* @return
|
||||
* @return select(1)
|
||||
*/
|
||||
JPQLQuery<Integer> selectOne();
|
||||
|
||||
/**
|
||||
* Create a new JPQLQuery instance with the projection zero
|
||||
*
|
||||
* @return
|
||||
* @return select(0)
|
||||
*/
|
||||
JPQLQuery<Integer> selectZero();
|
||||
|
||||
/**
|
||||
* Create a new JPQLQuery instance with the given source and projection
|
||||
*
|
||||
* @param from
|
||||
* @param from projection and source
|
||||
* @param <T>
|
||||
* @return
|
||||
* @return select(from).from(from)
|
||||
*/
|
||||
<T> JPQLQuery<T> selectFrom(EntityPath<T> from);
|
||||
|
||||
/**
|
||||
* Create a new Query with the given source
|
||||
*
|
||||
* @param from
|
||||
* @return
|
||||
* @param from from
|
||||
* @return from(from)
|
||||
*/
|
||||
JPQLQuery<?> from(EntityPath<?> from);
|
||||
|
||||
/**
|
||||
* Create a new UPDATE clause
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
* @param path entity to update
|
||||
* @return update clause
|
||||
*/
|
||||
UpdateClause<?> update(EntityPath<?> path);
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.core.util.MathUtils;
|
||||
|
||||
/**
|
||||
* JPQLSerializer serializes Querydsl expressions into JPQL syntax.
|
||||
* {@code JPQLSerializer} serializes Querydsl expressions into JPQL syntax.
|
||||
*
|
||||
* @author tiwe
|
||||
*/
|
||||
|
||||
@ -21,7 +21,7 @@ import com.querydsl.core.types.PathType;
|
||||
import com.querydsl.core.types.Templates;
|
||||
|
||||
/**
|
||||
* JPQLTemplates extends {@link Templates} to provide operator patterns for JPQL
|
||||
* {@code JPQLTemplates} extends {@link Templates} to provide operator patterns for JPQL
|
||||
* serialization
|
||||
*
|
||||
* @author tiwe
|
||||
|
||||
@ -31,7 +31,7 @@ import com.querydsl.core.types.*;
|
||||
import com.querydsl.sql.*;
|
||||
|
||||
/**
|
||||
* NativeSQLSerializer extends the SQLSerializer class to extract referenced entity paths and change
|
||||
* {@code NativeSQLSerializer} extends {@link SQLSerializer} to extract referenced entity paths and change
|
||||
* some serialization formats
|
||||
*
|
||||
* @author tiwe
|
||||
|
||||
@ -17,7 +17,7 @@ import com.querydsl.core.types.Ops;
|
||||
import com.querydsl.core.types.PathType;
|
||||
|
||||
/**
|
||||
* OpenJPATemplates extends JPQLTemplates with OpenJPA specific extensions
|
||||
* {@code OpenJPATemplates} extends {@link JPQLTemplates} with OpenJPA specific extensions
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -20,7 +20,7 @@ import com.mysema.commons.lang.CloseableIterator;
|
||||
import com.querydsl.core.types.FactoryExpression;
|
||||
|
||||
/**
|
||||
* QueryHandler provides injection of provider specific functionality into the query logic
|
||||
* {@code QueryHandle}r provides injection of provider specific functionality into the query logic
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
@ -28,47 +28,47 @@ import com.querydsl.core.types.FactoryExpression;
|
||||
public interface QueryHandler {
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return whether native queries should be created as typed queries
|
||||
*/
|
||||
boolean createNativeQueryTyped();
|
||||
|
||||
/**
|
||||
* Iterate the results with the optional projection
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
* @param query query
|
||||
* @return iterator
|
||||
*/
|
||||
<T> CloseableIterator<T> iterate(Query query, @Nullable FactoryExpression<?> projection);
|
||||
|
||||
/**
|
||||
* Add the given scalar to the given native query
|
||||
*
|
||||
* @param query
|
||||
* @param alias
|
||||
* @param type
|
||||
* @param query query
|
||||
* @param alias alias
|
||||
* @param type type
|
||||
*/
|
||||
void addScalar(Query query, String alias, Class<?> type);
|
||||
|
||||
/**
|
||||
* Add the given entity to the given native query
|
||||
*
|
||||
* @param query
|
||||
* @param alias
|
||||
* @param type
|
||||
* @param query query
|
||||
* @param alias alias
|
||||
* @param type type
|
||||
*/
|
||||
void addEntity(Query query, String alias, Class<?> type);
|
||||
|
||||
/**
|
||||
* Transform the results of the given query using the given factory expression
|
||||
*
|
||||
* @param query
|
||||
* @param projection
|
||||
* @return
|
||||
* @param query query
|
||||
* @param projection projection
|
||||
* @return true, if query as been modified
|
||||
*/
|
||||
boolean transform(Query query, FactoryExpression<?> projection);
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return whether entity projections need to be wrapped
|
||||
*/
|
||||
boolean wrapEntityProjections();
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ import org.hibernate.ScrollableResults;
|
||||
import com.mysema.commons.lang.CloseableIterator;
|
||||
|
||||
/**
|
||||
* ScrollableResultsIterator is an {@link CloseableIterator} adapter for ScrollableResults
|
||||
* {@code ScrollableResultsIterator} is a {@link CloseableIterator} adapter for ScrollableResults
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -21,6 +21,8 @@ import com.mysema.commons.lang.CloseableIterator;
|
||||
import com.querydsl.core.types.FactoryExpression;
|
||||
|
||||
/**
|
||||
* {@code TransformingIterator} is a CloseableIterator adapter that transforms via a {@link FactoryExpression} instance
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
* @param <T>
|
||||
|
||||
@ -90,7 +90,7 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
/**
|
||||
* Expose the original Hibernate query for the given projection
|
||||
*
|
||||
* @return
|
||||
* @return query
|
||||
*/
|
||||
public Query createQuery() {
|
||||
return createQuery(getMetadata().getModifiers(), false);
|
||||
@ -220,8 +220,8 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
* scrollability of the returned results depends upon JDBC driver
|
||||
* support for scrollable <tt>ResultSet</tt>s.<br>
|
||||
*
|
||||
* @param mode
|
||||
* @return
|
||||
* @param mode scroll mode
|
||||
* @return scrollable results
|
||||
*/
|
||||
public ScrollableResults scroll(ScrollMode mode) {
|
||||
try {
|
||||
@ -254,8 +254,8 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
|
||||
/**
|
||||
* Add a comment to the generated SQL.
|
||||
* @param comment
|
||||
* @return
|
||||
* @param comment comment
|
||||
* @return the current object
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Q setComment(String comment) {
|
||||
@ -266,6 +266,7 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
/**
|
||||
* Set a fetchJoin size for the underlying JDBC query.
|
||||
* @param fetchSize the fetchJoin size
|
||||
* @return the current object
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Q setFetchSize(int fetchSize) {
|
||||
@ -275,6 +276,7 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
|
||||
/**
|
||||
* Set the lock mode for the given path.
|
||||
* @return the current object
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Q setLockMode(Path<?> path, LockMode lockMode) {
|
||||
@ -284,6 +286,7 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
|
||||
/**
|
||||
* Override the current session flush mode, just for this query.
|
||||
* @return the current object
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Q setFlushMode(FlushMode flushMode) {
|
||||
@ -296,6 +299,8 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
* a read-only mode where Hibernate will never dirty-check
|
||||
* them or make changes persistent.
|
||||
*
|
||||
* @return the current object
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Q setReadOnly(boolean readOnly) {
|
||||
@ -306,6 +311,7 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
/**
|
||||
* Set a timeout for the underlying JDBC query.
|
||||
* @param timeout the timeout in seconds
|
||||
* @return the current object
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Q setTimeout(int timeout) {
|
||||
@ -347,8 +353,8 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
/**
|
||||
* Clone the state of this query to a new instance with the given Session
|
||||
*
|
||||
* @param session
|
||||
* @return
|
||||
* @param session session
|
||||
* @return cloned query
|
||||
*/
|
||||
public Q clone(Session session) {
|
||||
return this.clone(new DefaultSessionHolder(session));
|
||||
@ -357,8 +363,8 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
/**
|
||||
* Clone the state of this query to a new instance with the given StatelessSession
|
||||
*
|
||||
* @param session
|
||||
* @return
|
||||
* @param session session
|
||||
* @return cloned query
|
||||
*/
|
||||
public Q clone(StatelessSession session) {
|
||||
return this.clone(new StatelessSessionHolder(session));
|
||||
@ -367,7 +373,7 @@ public abstract class AbstractHibernateQuery<T, Q extends AbstractHibernateQuery
|
||||
/**
|
||||
* Clone the state of this query to a new instance
|
||||
*
|
||||
* @return
|
||||
* @return closed query
|
||||
*/
|
||||
public Q clone() {
|
||||
return this.clone(this.session);
|
||||
|
||||
@ -18,7 +18,7 @@ import org.hibernate.SQLQuery;
|
||||
import org.hibernate.Session;
|
||||
|
||||
/**
|
||||
* DefaultSessionHolder is the default implementation of the {@link SessionHolder} interface
|
||||
* {@code DefaultSessionHolder} is the default implementation of the {@link SessionHolder} interface
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -25,7 +25,7 @@ import com.querydsl.jpa.JPQLQuery;
|
||||
import com.querydsl.jpa.JPQLTemplates;
|
||||
|
||||
/**
|
||||
* HibernateQuery is the default implementation of the JPQLQuery interface for Hibernate
|
||||
* {@code HibernateQuery} is the default implementation of the JPQLQuery interface for Hibernate
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
@ -43,7 +43,7 @@ public class HibernateQuery<T> extends AbstractHibernateQuery<T, HibernateQuery<
|
||||
/**
|
||||
* Creates a new Session bound query
|
||||
*
|
||||
* @param session
|
||||
* @param session session
|
||||
*/
|
||||
public HibernateQuery(Session session) {
|
||||
super(new DefaultSessionHolder(session), HQLTemplates.DEFAULT, new DefaultQueryMetadata());
|
||||
@ -52,7 +52,7 @@ public class HibernateQuery<T> extends AbstractHibernateQuery<T, HibernateQuery<
|
||||
/**
|
||||
* Creates a new Session bound query
|
||||
*
|
||||
* @param session
|
||||
* @param session session
|
||||
*/
|
||||
public HibernateQuery(Session session, QueryMetadata metadata) {
|
||||
super(new DefaultSessionHolder(session), HQLTemplates.DEFAULT, metadata);
|
||||
@ -61,8 +61,8 @@ public class HibernateQuery<T> extends AbstractHibernateQuery<T, HibernateQuery<
|
||||
/**
|
||||
* Creates a new Session bound query
|
||||
*
|
||||
* @param session
|
||||
* @param templates
|
||||
* @param session session
|
||||
* @param templates templates
|
||||
*/
|
||||
public HibernateQuery(Session session, JPQLTemplates templates) {
|
||||
super(new DefaultSessionHolder(session), templates, new DefaultQueryMetadata());
|
||||
@ -71,7 +71,7 @@ public class HibernateQuery<T> extends AbstractHibernateQuery<T, HibernateQuery<
|
||||
/**
|
||||
* Creates a new Stateless session bound query
|
||||
*
|
||||
* @param session
|
||||
* @param session session
|
||||
*/
|
||||
public HibernateQuery(StatelessSession session) {
|
||||
super(new StatelessSessionHolder(session), HQLTemplates.DEFAULT, new DefaultQueryMetadata());
|
||||
@ -80,8 +80,8 @@ public class HibernateQuery<T> extends AbstractHibernateQuery<T, HibernateQuery<
|
||||
/**
|
||||
* Creates a new Session bound query
|
||||
*
|
||||
* @param session
|
||||
* @param templates
|
||||
* @param session session
|
||||
* @param templates templates
|
||||
*/
|
||||
public HibernateQuery(SessionHolder session, JPQLTemplates templates) {
|
||||
super(session, templates, new DefaultQueryMetadata());
|
||||
@ -90,9 +90,9 @@ public class HibernateQuery<T> extends AbstractHibernateQuery<T, HibernateQuery<
|
||||
/**
|
||||
* Creates a new Session bound query
|
||||
*
|
||||
* @param session
|
||||
* @param templates
|
||||
* @param metadata
|
||||
* @param session session
|
||||
* @param templates templates
|
||||
* @param metadata query metadata
|
||||
*/
|
||||
public HibernateQuery(SessionHolder session, JPQLTemplates templates, QueryMetadata metadata) {
|
||||
super(session, templates, metadata);
|
||||
|
||||
@ -46,6 +46,7 @@ public class HibernateQueryFactory implements JPQLQueryFactory {
|
||||
this.templates = templates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HibernateDeleteClause delete(EntityPath<?> path) {
|
||||
return new HibernateDeleteClause(session.get(), path, templates);
|
||||
}
|
||||
@ -85,14 +86,17 @@ public class HibernateQueryFactory implements JPQLQueryFactory {
|
||||
return select(from).from(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HibernateQuery<?> from(EntityPath<?> from) {
|
||||
return query().from(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HibernateUpdateClause update(EntityPath<?> path) {
|
||||
return new HibernateUpdateClause(session.get(), path, templates);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HibernateQuery<?> query() {
|
||||
return new HibernateQuery<Void>(session.get(), templates);
|
||||
}
|
||||
|
||||
@ -135,6 +135,7 @@ public class HibernateUpdateClause implements
|
||||
|
||||
/**
|
||||
* Set the lock mode for the given path.
|
||||
* @return the current object
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public HibernateUpdateClause setLockMode(Path<?> path, LockMode lockMode) {
|
||||
|
||||
@ -35,7 +35,7 @@ import com.querydsl.core.types.ParamNotSetException;
|
||||
import com.querydsl.core.types.dsl.Param;
|
||||
|
||||
/**
|
||||
* HibernateUtil provides static utility methods for Hibernate
|
||||
* {@code HibernateUtil} provides static utility methods for Hibernate
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -17,7 +17,7 @@ import org.hibernate.Query;
|
||||
import org.hibernate.SQLQuery;
|
||||
|
||||
/**
|
||||
* NoSessionHolder is a session holder for detached HibernateQuery usage
|
||||
* {@code NoSessionHolder} is a session holder for detached {@link HibernateQuery} usage
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -27,16 +27,16 @@ public interface SessionHolder {
|
||||
/**
|
||||
* Create a JPQL query for the given query string
|
||||
*
|
||||
* @param queryString
|
||||
* @return
|
||||
* @param queryString JPQL query string
|
||||
* @return query
|
||||
*/
|
||||
Query createQuery(String queryString);
|
||||
|
||||
/**
|
||||
* Create an SQL query for the given query string
|
||||
*
|
||||
* @param queryString
|
||||
* @return
|
||||
* @param queryString JPQL query string
|
||||
* @return query
|
||||
*/
|
||||
SQLQuery createSQLQuery(String queryString);
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ import com.querydsl.sql.Configuration;
|
||||
import com.querydsl.sql.SQLSerializer;
|
||||
|
||||
/**
|
||||
* AbstractHibernateSQLQuery is the base class for Hibernate Native SQL queries
|
||||
* {@code AbstractHibernateSQLQuery} is the base class for Hibernate Native SQL queries
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -24,7 +24,7 @@ import com.querydsl.sql.Configuration;
|
||||
import com.querydsl.sql.SQLTemplates;
|
||||
|
||||
/**
|
||||
* HibernateSQLQuery is an SQLQuery implementation that uses Hibernate's Native SQL functionality
|
||||
* {@code HibernateSQLQuery} is an SQLQuery implementation that uses Hibernate's Native SQL functionality
|
||||
* to execute queries
|
||||
*
|
||||
* @author tiwe
|
||||
|
||||
@ -87,7 +87,7 @@ public abstract class AbstractJPAQuery<T, Q extends AbstractJPAQuery<T, Q>> exte
|
||||
/**
|
||||
* Expose the original JPA query for the given projection
|
||||
*
|
||||
* @return
|
||||
* @return query
|
||||
*/
|
||||
public Query createQuery() {
|
||||
return createQuery(getMetadata().getModifiers(), false);
|
||||
@ -136,8 +136,8 @@ public abstract class AbstractJPAQuery<T, Q extends AbstractJPAQuery<T, Q>> exte
|
||||
/**
|
||||
* Transforms results using FactoryExpression if ResultTransformer can't be used
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
* @param query query
|
||||
* @return results
|
||||
*/
|
||||
private List<?> getResultList(Query query) {
|
||||
// TODO : use lazy fetch here?
|
||||
@ -163,8 +163,8 @@ public abstract class AbstractJPAQuery<T, Q extends AbstractJPAQuery<T, Q>> exte
|
||||
/**
|
||||
* Transforms results using FactoryExpression if ResultTransformer can't be used
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
* @param query query
|
||||
* @return single result
|
||||
*/
|
||||
@Nullable
|
||||
private Object getSingleResult(Query query) {
|
||||
@ -293,8 +293,8 @@ public abstract class AbstractJPAQuery<T, Q extends AbstractJPAQuery<T, Q>> exte
|
||||
/**
|
||||
* Clone the state of this query to a new instance with the given EntityManager
|
||||
*
|
||||
* @param entityManager
|
||||
* @return
|
||||
* @param entityManager entity manager
|
||||
* @return cloned query
|
||||
*/
|
||||
public abstract Q clone(EntityManager entityManager);
|
||||
|
||||
@ -302,16 +302,16 @@ public abstract class AbstractJPAQuery<T, Q extends AbstractJPAQuery<T, Q>> exte
|
||||
* Clone the state of this query to a new instance with the given EntityManager
|
||||
* and the specified templates
|
||||
*
|
||||
* @param entityManager
|
||||
* @param templates
|
||||
* @return
|
||||
* @param entityManager entity manager
|
||||
* @param templates templates
|
||||
* @return cloned query
|
||||
*/
|
||||
public abstract Q clone(EntityManager entityManager, JPQLTemplates templates);
|
||||
|
||||
/**
|
||||
* Clone the state of this query to a new instance
|
||||
*
|
||||
* @return
|
||||
* @return cloned query
|
||||
*/
|
||||
public Q clone() {
|
||||
return clone(entityManager, getTemplates());
|
||||
|
||||
@ -26,7 +26,7 @@ import com.querydsl.jpa.JPQLTemplates;
|
||||
import com.querydsl.jpa.OpenJPATemplates;
|
||||
|
||||
/**
|
||||
* JPAProvider provides detection of the JPA provider based on the EntityManager instance
|
||||
* {@code JPAProvider} provides detection of the JPA provider based on the EntityManager instance
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
|
||||
@ -20,9 +20,10 @@ import com.querydsl.core.QueryMetadata;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.core.types.Expression;
|
||||
import com.querydsl.jpa.JPQLTemplates;
|
||||
import com.querydsl.jpa.JPQLQuery;
|
||||
|
||||
/**
|
||||
* JPAQuery is the default implementation of the JPQLQuery interface for JPA
|
||||
* {@code JPAQuery} is the default implementation of the {@link JPQLQuery} interface for JPA
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
@ -40,7 +41,7 @@ public class JPAQuery<T> extends AbstractJPAQuery<T, JPAQuery<T>> {
|
||||
/**
|
||||
* Creates a new EntityManager bound query
|
||||
*
|
||||
* @param em
|
||||
* @param em entity manager
|
||||
*/
|
||||
public JPAQuery(EntityManager em) {
|
||||
super(em, JPAProvider.getTemplates(em), new DefaultQueryMetadata());
|
||||
@ -49,7 +50,8 @@ public class JPAQuery<T> extends AbstractJPAQuery<T, JPAQuery<T>> {
|
||||
/**
|
||||
* Creates a new EntityManager bound query
|
||||
*
|
||||
* @param em
|
||||
* @param em entity manager
|
||||
* @param metadata query metadata
|
||||
*/
|
||||
public JPAQuery(EntityManager em, QueryMetadata metadata) {
|
||||
super(em, JPAProvider.getTemplates(em), metadata);
|
||||
@ -58,8 +60,8 @@ public class JPAQuery<T> extends AbstractJPAQuery<T, JPAQuery<T>> {
|
||||
/**
|
||||
* Creates a new query
|
||||
*
|
||||
* @param em
|
||||
* @param templates
|
||||
* @param em entity manager
|
||||
* @param templates templates
|
||||
*/
|
||||
public JPAQuery(EntityManager em, JPQLTemplates templates) {
|
||||
super(em, templates, new DefaultQueryMetadata());
|
||||
@ -68,9 +70,9 @@ public class JPAQuery<T> extends AbstractJPAQuery<T, JPAQuery<T>> {
|
||||
/**
|
||||
* Creates a new query
|
||||
*
|
||||
* @param em
|
||||
* @param templates
|
||||
* @param metadata
|
||||
* @param em entity manager
|
||||
* @param templates temoplates
|
||||
* @param metadata query metadata
|
||||
*/
|
||||
public JPAQuery(EntityManager em, JPQLTemplates templates, QueryMetadata metadata) {
|
||||
super(em, templates, metadata);
|
||||
|
||||
@ -45,7 +45,7 @@ import com.querydsl.sql.Configuration;
|
||||
import com.querydsl.sql.SQLSerializer;
|
||||
|
||||
/**
|
||||
* AbstractJPASQLQuery is the base class for JPA Native SQL queries
|
||||
* {@code AbstractJPASQLQuery} is the base class for JPA Native SQL queries
|
||||
*
|
||||
* @author tiwe
|
||||
*
|
||||
@ -174,8 +174,8 @@ public abstract class AbstractJPASQLQuery<T, Q extends AbstractJPASQLQuery<T, Q>
|
||||
/**
|
||||
* Transforms results using FactoryExpression if ResultTransformer can't be used
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
* @param query query
|
||||
* @return results
|
||||
*/
|
||||
private List<?> getResultList(Query query) {
|
||||
// TODO : use lazy fetch here?
|
||||
@ -209,8 +209,8 @@ public abstract class AbstractJPASQLQuery<T, Q extends AbstractJPASQLQuery<T, Q>
|
||||
/**
|
||||
* Transforms results using FactoryExpression if ResultTransformer can't be used
|
||||
*
|
||||
* @param query
|
||||
* @return
|
||||
* @param query query
|
||||
* @return single result
|
||||
*/
|
||||
@Nullable
|
||||
private Object getSingleResult(Query query) {
|
||||
|
||||
@ -23,7 +23,7 @@ import com.querydsl.sql.Configuration;
|
||||
import com.querydsl.sql.SQLTemplates;
|
||||
|
||||
/**
|
||||
* JPASQLQuery is an SQLQuery implementation that uses JPA Native SQL functionality
|
||||
* {@code JPASQLQuery} is an SQLQuery implementation that uses JPA Native SQL functionality
|
||||
* to execute queries
|
||||
*
|
||||
* @author tiwe
|
||||
|
||||
Loading…
Reference in New Issue
Block a user