List of usage examples for javax.persistence.criteria Selection alias
Selection<X> alias(String name);
From source file:org.jdal.dao.jpa.JpaUtils.java
/** * Gets The result alias, if none set a default one and return it * @param selection /* w ww . ja v a2 s . c om*/ * @return root alias or generated one */ public static synchronized <T> String getOrCreateAlias(Selection<T> selection) { // reset alias count if (aliasCount > 1000) aliasCount = 0; String alias = selection.getAlias(); if (alias == null) { alias = "JDAL_generatedAlias" + aliasCount++; selection.alias(alias); } return alias; }
From source file:com.zero.dao.impl.BaseDaoImpl.java
private synchronized String getAlias(Selection<?> selection) { if (selection != null) { String alias = selection.getAlias(); if (alias == null) { if (aliasCount >= 1000) { aliasCount = 0;/*from ww w.j av a 2 s . c o m*/ } alias = "shopxxGeneratedAlias" + aliasCount++; selection.alias(alias); } return alias; } return null; }
From source file:net.osxx.dao.impl.BaseDaoImpl.java
private synchronized String getAlias(Selection<?> selection) { if (selection != null) { String alias = selection.getAlias(); if (alias == null) { if (aliasCount >= 1000) { aliasCount = 0;//from w ww . ja va2 s. com } alias = "osxxGeneratedAlias" + aliasCount++; selection.alias(alias); } return alias; } return null; }
From source file:com.dp2345.dao.impl.BaseDaoImpl.java
private synchronized String getAlias(Selection<?> selection) { if (selection != null) { String alias = selection.getAlias(); if (alias == null) { if (aliasCount >= 1000) { aliasCount = 0;//from w w w. j ava2 s . com } alias = "dp2345GeneratedAlias" + aliasCount++; selection.alias(alias); } return alias; } return null; }
From source file:gov.guilin.dao.impl.BaseDaoImpl.java
private synchronized String getAlias(Selection<?> selection) { if (selection != null) { String alias = selection.getAlias(); if (alias == null) { if (aliasCount >= 1000) { aliasCount = 0;//from w w w .j ava 2 s. c om } alias = "guilinGeneratedAlias" + aliasCount++; selection.alias(alias); } return alias; } return null; }
From source file:net.groupbuy.dao.impl.BaseDaoImpl.java
private synchronized String getAlias(Selection<?> selection) { if (selection != null) { String alias = selection.getAlias(); if (alias == null) { if (aliasCount >= 1000) { aliasCount = 0;//from w w w . ja va 2 s. co m } alias = "groupbuyGeneratedAlias" + aliasCount++; selection.alias(alias); } return alias; } return null; }
From source file:com.sammyun.dao.impl.BaseDaoImpl.java
private synchronized String getAlias(Selection<?> selection) { if (selection != null) { String alias = selection.getAlias(); if (alias == null) { if (aliasCount >= 1000) { aliasCount = 0;//from w w w. j a va 2 s . c o m } alias = "preschoolEduGeneratedAlias" + aliasCount++; selection.alias(alias); } return alias; } return null; }
From source file:org.easy.criteria.CriteriaComposer.java
/** * @param out// ww w.j a va 2s . co m */ @SuppressWarnings("unchecked") protected void generateSelect(final CriteriaBuilder criteriaBuilder, final List<Selection<?>> out) { Preconditions.checkNotNull(out); if (multiselect != null && multiselect.size() > 0) { out.addAll(multiselect); } if (_selects != null && _selects.size() > 0) { for (SelectContainer<E> selectContainer : _selects) { if (selectContainer.function == null) { Selection<?> selection = root.get(selectContainer.singularAttribute); selection.alias(selectContainer.alias); out.add(selection); } else { @SuppressWarnings("rawtypes") Expression numExp = null; switch (selectContainer.function) { case COUNT: numExp = criteriaBuilder.count(root.get(selectContainer.singularAttribute)); numExp.alias(selectContainer.alias); break; case AVG: numExp = criteriaBuilder.avg(root.get(selectContainer.singularAttribute)); numExp.alias(selectContainer.alias); break; case SUM: numExp = criteriaBuilder.sum(root.get(selectContainer.singularAttribute)); numExp.alias(selectContainer.alias); break; case MAX: numExp = criteriaBuilder.max(root.get(selectContainer.singularAttribute)); numExp.alias(selectContainer.alias); break; case MIN: numExp = criteriaBuilder.min(root.get(selectContainer.singularAttribute)); numExp.alias(selectContainer.alias); break; } if (numExp != null) out.add(numExp); } } } if (_joins != null) { Set<Entry<JoinContainer<E>, CriteriaComposer<?>>> allSetJoins = _joins.entrySet(); for (Entry<JoinContainer<E>, CriteriaComposer<?>> join : allSetJoins) { CriteriaComposer<?> subCriteria = join.getValue(); if (subCriteria != null) subCriteria.generateSelect(criteriaBuilder, out); } } }