com.mysema.query.jpa.impl.JPAQuery Java Examples
The following examples show how to use
com.mysema.query.jpa.impl.JPAQuery.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PermissionService.java From spring-boot-practice with Apache License 2.0 | 5 votes |
public JPAQuery createQuery(Predicate predicate) { QPermission permission = QPermission.permission; QRolePermission rolePermission = QRolePermission.rolePermission; QRole role = QRole.role; return new JPAQuery(em) .from(permission) .leftJoin(permission.rolePermission, rolePermission) .leftJoin(rolePermission.role, role) .where(predicate); }
Example #2
Source File: PermissionService.java From spring-boot-practice with Apache License 2.0 | 5 votes |
public JPAQuery createQuery(Predicate predicate) { QPermission permission = QPermission.permission; QRolePermission rolePermission = QRolePermission.rolePermission; QRole role = QRole.role; BooleanBuilder builder = new BooleanBuilder(); builder.and(predicate); builder.and(permission.deletedAt.isNull()); builder.and(rolePermission.deletedAt.isNull()); builder.and(role.deletedAt.isNull()); return new JPAQuery(em) .from(permission) .leftJoin(permission.rolePermission, rolePermission) .leftJoin(rolePermission.role, role) .where(builder); }
Example #3
Source File: EmployeeService.java From spring-boot-practice with Apache License 2.0 | 4 votes |
private JPAQuery createQuery(Predicate predicate) { return new JPAQuery(entityManager) .from(QEmployee.employee) .leftJoin(QEmployee.employee.department) .where(predicate); }
Example #4
Source File: QueryDslRepositoryExtension.java From tutorials with MIT License | 4 votes |
@Override public JPAQuery jpaQuery() { return new JPAQuery(context.getEntityManager()); }
Example #5
Source File: DatatablesUtils.java From gvnix with GNU General Public License v3.0 | 4 votes |
/** * Prepares associationMap for findByCriteria * * @param entity * @param filterByAssociations * @param datatablesCriterias * @param findInAllColumns * @param query * @param associationMap * @return */ public static <T> JPAQuery prepareQueryAssociationMap( PathBuilder<T> entity, Map<String, List<String>> filterByAssociations, DatatablesCriterias datatablesCriterias, boolean findInAllColumns, JPAQuery query, Map<String, PathBuilder<?>> associationMap) { LOGGER.debug("Preparing associationMap and joins for entity {}...", entity.getType()); for (ColumnDef column : datatablesCriterias.getColumnDefs()) { // true if the search must include this column boolean findInColumn = StringUtils.isNotEmpty(column.getSearch()); // If no joins given for this column, don't add the JOIN to query // to improve performance String associationName = unescapeDot(column.getName()); if (!filterByAssociations.containsKey(associationName)) { continue; } // If column is not sortable and is not filterable, don't add the // JOIN to query to improve performance if (!column.isSortable() && !column.isFilterable()) { continue; } // If column is not sortable and no search value provided, // don't add the JOIN to query to improve performance if (!column.isSortable() && !findInColumn && !findInAllColumns) { continue; } // Here the column is sortable or it is filterable and column search // value or all-column search value is provided PathBuilder<?> associationPath = entity.get(associationName); query = query.join(associationPath); // Store join path for later use in where associationMap.put(associationName, associationPath); LOGGER.trace("Added join {} -> {} as {}...", entity.getType(), associationPath, associationName); } return query; }
Example #6
Source File: DatatablesUtilsBeanImpl.java From gvnix with GNU General Public License v3.0 | 4 votes |
/** * {@inheritDoc} */ @Override public JPAQuery newJPAQuery(EntityManager em) { return new JPAQuery(em); }
Example #7
Source File: DatatablesUtilsBeanImpl.java From gvnix with GNU General Public License v3.0 | 4 votes |
/** * {@inheritDoc} */ @Override public <T> JPAQuery prepareQueryAssociationMap(PathBuilder<T> entity, Map<String, List<String>> filterByAssociations, DatatablesCriterias datatablesCriterias, boolean findInAllColumns, JPAQuery query, Map<String, PathBuilder<?>> associationMap) { LOGGER.debug("Preparing associationMap and joins for entity {}...", entity.getType()); for (ColumnDef column : datatablesCriterias.getColumnDefs()) { // true if the search must include this column boolean findInColumn = StringUtils.isNotEmpty(column.getSearch()); // If no joins given for this column, don't add the JOIN to query // to improve performance String associationName = unescapeDot(column.getName()); if (!filterByAssociations.containsKey(associationName)) { continue; } // If column is not sortable and is not filterable, don't add the // JOIN to query to improve performance if (!column.isSortable() && !column.isFilterable()) { continue; } // If column is not sortable and no search value provided, // don't add the JOIN to query to improve performance if (!column.isSortable() && !findInColumn && !findInAllColumns) { continue; } // Here the column is sortable or it is filterable and column search // value or all-column search value is provided PathBuilder<?> associationPath = entity.get(associationName); query = query.join(associationPath); // Store join path for later use in where associationMap.put(associationName, associationPath); LOGGER.trace("Added join {} -> {} as {}...", entity.getType(), associationPath, associationName); } return query; }
Example #8
Source File: DatatablesUtilsBean.java From gvnix with GNU General Public License v3.0 | 2 votes |
/** * Creates and returns a new JPAQuery instance for the provided * EntityManager * * @param em ActiveRecord JPA EntityManager * @return JPAQuery instance for provided EntityManager */ public JPAQuery newJPAQuery(EntityManager em);
Example #9
Source File: DatatablesUtilsBean.java From gvnix with GNU General Public License v3.0 | 2 votes |
/** * Prepares associationMap for findByCriteria * * @param entity * @param filterByAssociations * @param datatablesCriterias * @param findInAllColumns * @param query * @param associationMap * @return */ public <T> JPAQuery prepareQueryAssociationMap(PathBuilder<T> entity, Map<String, List<String>> filterByAssociations, DatatablesCriterias datatablesCriterias, boolean findInAllColumns, JPAQuery query, Map<String, PathBuilder<?>> associationMap);
Example #10
Source File: QueryDslSupport.java From tutorials with MIT License | votes |
JPAQuery jpaQuery();