mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
Use UnderscoreTemplates
This commit is contained in:
parent
e100e9800a
commit
11825e2ad2
@ -544,6 +544,16 @@ public final class ExpressionUtils {
|
||||
return variable + "_" + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new root variable based on the given path
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public static String createRootVariable(Path<?> path) {
|
||||
return path.accept(ToStringVisitor.DEFAULT, TEMPLATES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the given object to an Expression
|
||||
*
|
||||
|
||||
@ -137,7 +137,7 @@ public class JPAQueryMixin<T> extends QueryMixin<T> {
|
||||
}
|
||||
} else if (metadata.getParent().getMetadata().isRoot()) {
|
||||
Class<T> type = getElementTypeOrType(path);
|
||||
Path<T> newPath = new PathImpl<T>(type, path.toString().replace('.', '_'));
|
||||
Path<T> newPath = new PathImpl<T>(type, ExpressionUtils.createRootVariable(path));
|
||||
leftJoin(path, newPath);
|
||||
return newPath;
|
||||
} else {
|
||||
@ -145,7 +145,7 @@ public class JPAQueryMixin<T> extends QueryMixin<T> {
|
||||
Path<?> parent = shorten(metadata.getParent(), paths);
|
||||
Path<T> oldPath = new PathImpl<T>(path.getType(),
|
||||
new PathMetadata(parent, metadata.getElement(), metadata.getPathType()));
|
||||
Path<T> newPath = new PathImpl<T>(type, oldPath.toString().replace('.', '_'));
|
||||
Path<T> newPath = new PathImpl<T>(type, ExpressionUtils.createRootVariable(oldPath));
|
||||
aliases.put(path, newPath);
|
||||
leftJoin(oldPath, newPath);
|
||||
return newPath;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user