Skip to content

Commit

Permalink
2.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
eXsio committed Jan 27, 2020
1 parent 5bd362d commit 153ba14
Show file tree
Hide file tree
Showing 36 changed files with 392 additions and 202 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
- 2.4.3
- added @Generated annotation
- added alternative static field
- added serialVersionUid
- 2.4.2
- don't use wildcards in imports of static models
- 2.4.1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ In the most basic form you just need EntityQL, JPA API and QueryDSL-SQL:
<dependency>
<groupId>com.github.eXsio</groupId>
<artifactId>querydsl-entityql</artifactId>
<version>2.4.2</version>
<version>2.4.3</version>
</dependency>

<!-- QueryDSL itself -->
Expand Down Expand Up @@ -375,7 +375,7 @@ new QExporter().export(qEntity(YourEntity.class), fileNamePattern, packageName,

Generated classes are fully compatible with Java and Groovy.

**Since 2.4.2 Static Models contain all the dynamic features of the Dynamic Models!:**
**Since 2.4.3 Static Models contain all the dynamic features of the Dynamic Models!:**

```java

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.eXsio</groupId>
<artifactId>querydsl-entityql</artifactId>
<version>2.4.2</version>
<version>2.4.3</version>

<parent>
<groupId>org.springframework.boot</groupId>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/pl/exsio/querydsl/entityql/QBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public abstract class QBase<E> extends RelationalPathBase<E> {
super(type, variable, schema, table);
}



protected <C extends StoreClause<C>> StoreClause<C> set(StoreClause<C> clause, Function<Object, Path<Object>> pathProvider, Object... params) {
if (params.length % 2 != 0) {
throw new InvalidArgumentException("Odd number of parameters");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/pl/exsio/querydsl/entityql/QExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
* Utility Class used to generate Static Java classes from the Dynamic Q Models.
Expand Down Expand Up @@ -80,11 +81,14 @@ private Path getFilePath(String pkgName, String destinationPath, String fileName
private <E> String renderClass(Q<E> q, String pkgName, Class<? extends E> type, String fileName, boolean isGroovy) {
String className = FilenameUtils.removeExtension(fileName);
JtwigTemplate template = JtwigTemplate.classpathTemplate("staticTemplate.twig", configuration);
int hash = Objects.hash(q.columns().keySet(), q.joinColumns().keySet(), q.inverseJoinColumns().keySet());
return template.render(JtwigModel.newModel()
.with("package", pkgName)
.with("className", className)
.with("entityName", type.getName())
.with("entitySimpleName", type.getSimpleName())
.with("exporterName", getClass().getName())
.with("uid", hash)
.with("q", q)
.with("isGroovy", isGroovy)
);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/pl/exsio/querydsl/entityql/QStaticModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public QStaticModel(Class<? extends E> type, String variable, String schema, Str
super(type, variable, schema, table);
}



/**
* Convenience method used to quiclky set values on insert/update/merge clauses.
* Method requires the 'params' parameter to be of even size.
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/staticTemplate.twig
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {{entityName}};
import {{fkPath.config.computedFieldType.name}};
{% endfor %}
{% endfor %}
import javax.annotation.Generated;
{% if(isGroovy) %}
import groovy.transform.CompileStatic;
{% else %}
Expand All @@ -51,10 +52,15 @@ import java.util.List;
{% if(isGroovy) %}
@CompileStatic
{% endif %}
@Generated("{{exporterName}}")
public final class {{ className }} extends QStaticModel<{{entitySimpleName}}> {

private static final long serialVersionUID = {{uid}};

public static final {{ className }} INSTANCE = new {{ className }}();

public static final {{ className }} q{{entitySimpleName}} = INSTANCE;

{% for name, path in q.rawColumns %}
public final {{macros.printColumnType(path)}} {{ name }};
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ import pl.exsio.querydsl.entityql.QPathFactory
import pl.exsio.querydsl.entityql.QStaticModel
import pl.exsio.querydsl.entityql.jpa.entity.it.Book

import javax.annotation.Generated

/**
* This class was generated by EntityQL (https://github.com/eXsio/querydsl-entityql). It is not
* recommended to make any changes to this class. Any manual changes will be lost upon the next
* class generation.
*/
@CompileStatic
@Generated("pl.exsio.querydsl.entityql.QExporter")
public final class QBook extends QStaticModel<Book> {

private static final long serialVersionUID = 1595067359;

public static final QBook INSTANCE = new QBook();

public static final QBook qBook = INSTANCE;

public final NumberPath<Long> id;

public final StringPath name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,23 @@ import pl.exsio.querydsl.entityql.jpa.entity.it.CompositeFk
import pl.exsio.querydsl.entityql.jpa.entity.it.CompositePk
import pl.exsio.querydsl.entityql.jpa.entity.it.SingularPk

import javax.annotation.Generated

/**
* This class was generated by EntityQL (https://github.com/eXsio/querydsl-entityql). It is not
* recommended to make any changes to this class. Any manual changes will be lost upon the next
* class generation.
*/
@CompileStatic
@Generated("pl.exsio.querydsl.entityql.QExporter")
public final class QCompositeFk extends QStaticModel<CompositeFk> {

private static final long serialVersionUID = 594020407;

public static final QCompositeFk INSTANCE = new QCompositeFk();

public static final QCompositeFk qCompositeFk = INSTANCE;

public final NumberPath<Long> id;

public final StringPath desc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ import pl.exsio.querydsl.entityql.QStaticModel
import pl.exsio.querydsl.entityql.jpa.entity.it.CompositeFk
import pl.exsio.querydsl.entityql.jpa.entity.it.CompositePk

import javax.annotation.Generated

/**
* This class was generated by EntityQL (https://github.com/eXsio/querydsl-entityql). It is not
* recommended to make any changes to this class. Any manual changes will be lost upon the next
* class generation.
*/
@CompileStatic
@Generated("pl.exsio.querydsl.entityql.QExporter")
public final class QCompositePk extends QStaticModel<CompositePk> {

private static final long serialVersionUID = -1372227420;

public static final QCompositePk INSTANCE = new QCompositePk();

public static final QCompositePk qCompositePk = INSTANCE;

public final NumberPath<Long> id1;

public final StringPath id2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ import pl.exsio.querydsl.entityql.QStaticModel
import pl.exsio.querydsl.entityql.jpa.entity.it.Group
import pl.exsio.querydsl.entityql.jpa.entity.it.GroupAdmin

import javax.annotation.Generated

/**
* This class was generated by EntityQL (https://github.com/eXsio/querydsl-entityql). It is not
* recommended to make any changes to this class. Any manual changes will be lost upon the next
* class generation.
*/
@CompileStatic
@Generated("pl.exsio.querydsl.entityql.QExporter")
public final class QGroup extends QStaticModel<Group> {

private static final long serialVersionUID = 1844673376;

public static final QGroup INSTANCE = new QGroup();

public static final QGroup qGroup = INSTANCE;

public final NumberPath<Long> id;

public final StringPath name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ import pl.exsio.querydsl.entityql.QPathFactory
import pl.exsio.querydsl.entityql.QStaticModel
import pl.exsio.querydsl.entityql.jpa.entity.it.GroupAdmin

import javax.annotation.Generated

/**
* This class was generated by EntityQL (https://github.com/eXsio/querydsl-entityql). It is not
* recommended to make any changes to this class. Any manual changes will be lost upon the next
* class generation.
*/
@CompileStatic
@Generated("pl.exsio.querydsl.entityql.QExporter")
public final class QGroupAdmin extends QStaticModel<GroupAdmin> {

private static final long serialVersionUID = -1049580923;

public static final QGroupAdmin INSTANCE = new QGroupAdmin();

public static final QGroupAdmin qGroupAdmin = INSTANCE;

public final NumberPath<Long> id;

public final StringPath name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ import pl.exsio.querydsl.entityql.jpa.entity.it.Order
import pl.exsio.querydsl.entityql.jpa.entity.it.OrderItem
import pl.exsio.querydsl.entityql.jpa.entity.it.User

import javax.annotation.Generated

/**
* This class was generated by EntityQL (https://github.com/eXsio/querydsl-entityql). It is not
* recommended to make any changes to this class. Any manual changes will be lost upon the next
* class generation.
*/
@CompileStatic
@Generated("pl.exsio.querydsl.entityql.QExporter")
public final class QOrder extends QStaticModel<Order> {

private static final long serialVersionUID = 1021087534;

public static final QOrder INSTANCE = new QOrder();

public static final QOrder qOrder = INSTANCE;

public final NumberPath<Long> id;

public final NumberPath<Long> userId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
package pl.exsio.querydsl.entityql.jpa.entity.it.generated

import com.querydsl.core.types.Path
import com.querydsl.core.types.dsl.NumberPath
import com.querydsl.sql.ForeignKey
import com.querydsl.sql.PrimaryKey
import groovy.transform.CompileStatic
import pl.exsio.querydsl.entityql.QColumnMetadataFactory
import pl.exsio.querydsl.entityql.QPathConfig
import pl.exsio.querydsl.entityql.QPathFactory
import pl.exsio.querydsl.entityql.QStaticModel
import pl.exsio.querydsl.entityql.jpa.entity.it.Book
import pl.exsio.querydsl.entityql.jpa.entity.it.Order
import pl.exsio.querydsl.entityql.jpa.entity.it.OrderItem
package pl.exsio.querydsl.entityql.jpa.entity.it.generated;

import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.NumberPath;
import com.querydsl.sql.ForeignKey;
import com.querydsl.sql.PrimaryKey;
import groovy.transform.CompileStatic;
import javax.annotation.Generated;
import pl.exsio.querydsl.entityql.QColumnMetadataFactory;
import pl.exsio.querydsl.entityql.QPathConfig;
import pl.exsio.querydsl.entityql.QPathFactory;
import pl.exsio.querydsl.entityql.QStaticModel;
import pl.exsio.querydsl.entityql.jpa.entity.it.Book;
import pl.exsio.querydsl.entityql.jpa.entity.it.Order;
import pl.exsio.querydsl.entityql.jpa.entity.it.OrderItem;

/**
* This class was generated by EntityQL (https://github.com/eXsio/querydsl-entityql). It is not
* recommended to make any changes to this class. Any manual changes will be lost upon the next
* class generation.
*/
@CompileStatic
@Generated("pl.exsio.querydsl.entityql.QExporter")
public final class QOrderItem extends QStaticModel<OrderItem> {

private static final long serialVersionUID = 673930422;

public static final QOrderItem INSTANCE = new QOrderItem();

public static final QOrderItem qOrderItem = INSTANCE;

public final NumberPath<Long> id;

public final NumberPath<Long> quantity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
package pl.exsio.querydsl.entityql.jpa.entity.it.generated

import com.querydsl.core.types.Path
import com.querydsl.core.types.dsl.NumberPath
import com.querydsl.core.types.dsl.StringPath
import com.querydsl.sql.ForeignKey
import com.querydsl.sql.PrimaryKey
import groovy.transform.CompileStatic
import pl.exsio.querydsl.entityql.QColumnMetadataFactory
import pl.exsio.querydsl.entityql.QPathConfig
import pl.exsio.querydsl.entityql.QPathFactory
import pl.exsio.querydsl.entityql.QStaticModel
import pl.exsio.querydsl.entityql.jpa.entity.it.CompositeFk
import pl.exsio.querydsl.entityql.jpa.entity.it.SingularPk
package pl.exsio.querydsl.entityql.jpa.entity.it.generated;

import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.NumberPath;
import com.querydsl.core.types.dsl.StringPath;
import com.querydsl.sql.ForeignKey;
import com.querydsl.sql.PrimaryKey;
import groovy.transform.CompileStatic;
import javax.annotation.Generated;
import pl.exsio.querydsl.entityql.QColumnMetadataFactory;
import pl.exsio.querydsl.entityql.QPathConfig;
import pl.exsio.querydsl.entityql.QPathFactory;
import pl.exsio.querydsl.entityql.QStaticModel;
import pl.exsio.querydsl.entityql.jpa.entity.it.CompositeFk;
import pl.exsio.querydsl.entityql.jpa.entity.it.SingularPk;

/**
* This class was generated by EntityQL (https://github.com/eXsio/querydsl-entityql). It is not
* recommended to make any changes to this class. Any manual changes will be lost upon the next
* class generation.
*/
@CompileStatic
@Generated("pl.exsio.querydsl.entityql.QExporter")
public final class QSingularPk extends QStaticModel<SingularPk> {

private static final long serialVersionUID = -1372227420;

public static final QSingularPk INSTANCE = new QSingularPk();

public static final QSingularPk qSingularPk = INSTANCE;

public final NumberPath<Long> id1;

public final StringPath id2;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
package pl.exsio.querydsl.entityql.jpa.entity.it.generated

import com.querydsl.core.types.Path
import com.querydsl.core.types.dsl.ArrayPath
import com.querydsl.sql.PrimaryKey
import groovy.transform.CompileStatic
import pl.exsio.querydsl.entityql.QColumnMetadataFactory
import pl.exsio.querydsl.entityql.QPathConfig
import pl.exsio.querydsl.entityql.QPathFactory
import pl.exsio.querydsl.entityql.QStaticModel
import pl.exsio.querydsl.entityql.jpa.entity.it.UploadedFile
import pl.exsio.querydsl.entityql.path.QUuidPath

import java.lang.reflect.Array
package pl.exsio.querydsl.entityql.jpa.entity.it.generated;

import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.ArrayPath;
import com.querydsl.sql.PrimaryKey;
import groovy.transform.CompileStatic;
import java.lang.reflect.Array;
import java.util.UUID;
import javax.annotation.Generated;
import pl.exsio.querydsl.entityql.QColumnMetadataFactory;
import pl.exsio.querydsl.entityql.QPathConfig;
import pl.exsio.querydsl.entityql.QPathFactory;
import pl.exsio.querydsl.entityql.QStaticModel;
import pl.exsio.querydsl.entityql.jpa.entity.it.UploadedFile;
import pl.exsio.querydsl.entityql.path.QUuidPath;

/**
* This class was generated by EntityQL (https://github.com/eXsio/querydsl-entityql). It is not
* recommended to make any changes to this class. Any manual changes will be lost upon the next
* class generation.
*/
@CompileStatic
@Generated("pl.exsio.querydsl.entityql.QExporter")
public final class QUploadedFile extends QStaticModel<UploadedFile> {

private static final long serialVersionUID = -1335667740;

public static final QUploadedFile INSTANCE = new QUploadedFile();

public static final QUploadedFile qUploadedFile = INSTANCE;

public final QUuidPath id;

public final ArrayPath<byte[], Byte> data;
Expand Down
Loading

0 comments on commit 153ba14

Please sign in to comment.