org.hibernate.Criteria Java Examples
The following examples show how to use
org.hibernate.Criteria.
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: WhatifWorkflowDAOHibImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
public List<SbiWhatifWorkflow> getWorkflowByModel(int modelId) { logger.debug("IN"); Session aSession = null; try { aSession = getSession(); Criteria criteria = aSession.createCriteria(SbiWhatifWorkflow.class); Criterion rest1 = Restrictions.eq("modelId", modelId); criteria.add(rest1); criteria.addOrder(Order.asc("sequcence")); return criteria.list(); } catch (HibernateException he) { logger.error("Error loading workflow for model" + modelId, he); throw new SpagoBIRuntimeException("Error loading workflow for model" + modelId, he); } finally { if (aSession != null) { if (aSession.isOpen()) aSession.close(); } logger.debug("OUT"); } }
Example #2
Source File: ChatManagerImpl.java From sakai with Educational Community License v2.0 | 6 votes |
public int getChannelMessagesCount(ChatChannel channel, String context, Date date) { if (channel == null) { // default to the first one List<ChatChannel> channels = getContextChannels(context, true); if (channels != null && channels.size() > 0) { channel = channels.iterator().next(); } } int count = 0; if (channel != null) { Criteria c = this.getSessionFactory().getCurrentSession().createCriteria(ChatMessage.class); c.add(Expression.eq("chatChannel", channel)); if (date != null) { c.add(Expression.ge("messageDate", date)); } c.setProjection(Projections.rowCount()); count = ((Long) c.uniqueResult()).intValue(); } return count; }
Example #3
Source File: NetworkUsageDao.java From DataHubSystem with GNU Affero General Public License v3.0 | 6 votes |
public long getDownloadedSizeByUserSince (final User user, final Date date) { Long result = getHibernateTemplate ().execute (new HibernateCallback<Long> () { @Override public Long doInHibernate (Session session) throws HibernateException, SQLException { Criteria criteria = session.createCriteria ( NetworkUsage.class); criteria.setProjection (Projections.sum ("size")); criteria.add (Restrictions.eq ("isDownload", true)); criteria.add (Restrictions.eq ("user", user)); criteria.add (Restrictions.gt ("date", date)); return (Long) criteria.uniqueResult (); } }); return (result == null) ? 0 : result; }
Example #4
Source File: ConfidenceStatisticsResourceFacadeImp.java From AIDR with GNU Affero General Public License v3.0 | 6 votes |
@Override public List<ConfidenceData> getDataInIntervalWithBin(String crisisCode, String attributeCode, String labelCode, Long timestamp1, Long timestamp2, Integer bin) { Criteria criteria = getCurrentSession().createCriteria(ConfidenceData.class); Criterion criterion = Restrictions.conjunction() .add(Restrictions.eq("crisisCode", crisisCode)) .add(Restrictions.eq("attributeCode", attributeCode)) .add(Restrictions.eq("labelCode", labelCode)) .add(Restrictions.ge("timestamp", timestamp1)) .add(Restrictions.le("timestamp", timestamp2)) .add(Restrictions.ge("bin", bin)); criteria.add(criterion); try { List<ConfidenceData> objList = (List<ConfidenceData>) criteria.list(); return objList; } catch (HibernateException e) { logger.error("exception", e); e.printStackTrace(); } return null; }
Example #5
Source File: DBQueryUtil.java From kardio with Apache License 2.0 | 6 votes |
/** * Get the previous days number of apis for a particular component * * @return int */ private static int getPreiousNumApis(final int compId, final Date date, final int envId) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, -1); Session session = HibernateConfig.getSessionFactory().getCurrentSession(); Transaction txn = session.beginTransaction(); Criteria ctrStsCrit = session.createCriteria(ApiStatusEntity.class, "as"); ctrStsCrit.add(Restrictions.eq("as.component.componentId",compId)); ctrStsCrit.add(Restrictions.eq("as.environment.environmentId",envId)); ctrStsCrit.add(Restrictions.eq("as.statusDate", new java.sql.Date(cal.getTimeInMillis()) )); ctrStsCrit.setMaxResults(1); ApiStatusEntity apiSts =(ApiStatusEntity) ctrStsCrit.uniqueResult(); int totalApi = 0; if(apiSts != null){ totalApi = apiSts.getTotalApi(); } txn.commit(); return totalApi; }
Example #6
Source File: DBQueryUtil.java From kardio with Apache License 2.0 | 6 votes |
/** * get CurrentHealth Check Details from DB. * * @param componentId * @param environmentId * @param regionID * @param healthCheckType * @return * @ */ private static HealthCheckVO getCurrentHealthCheckDetails(final int componentId, final int environmentId, final long regionID,final HealthCheckType healthCheckType) { Session session = HibernateConfig.getSessionFactory().getCurrentSession(); Transaction txn = session.beginTransaction(); Criteria hcCrit = session.createCriteria(HealthCheckEntity.class,"hc"); hcCrit.add(Restrictions.eq("hc.component.componentId", componentId)); hcCrit.add(Restrictions.eq("hc.environment.environmentId", environmentId)); hcCrit.add(Restrictions.eq("hc.region.regionId", regionID)); if(healthCheckType != null) { hcCrit.add(Restrictions.eq("hc.healthCheckType.healthCheckTypeId", healthCheckType.getHealthCheckTypeId())); } hcCrit.setMaxResults(1); HealthCheckEntity hcEnt = (HealthCheckEntity) hcCrit.uniqueResult(); txn.commit(); if(hcEnt == null){ return null; } HealthCheckVO hcVO = new HealthCheckVO(); hcVO.setHealthCheckId(hcEnt.getHealthCheckId()); if(hcEnt.getCurrentStatus() != null){ hcVO.setCurrentStatus(hcEnt.getCurrentStatus().getStatusId()); } return hcVO; }
Example #7
Source File: K8sPodsStatusDaoImpl.java From kardio with Apache License 2.0 | 6 votes |
@Override public long getCurrentNumberOfPods(int envId, String componentIdsStrg, boolean isParentComponents) throws ParseException { List<Integer> comIdList = DaoUtil.convertCSVToList(componentIdsStrg); Session session = sessionFactory.openSession(); DetachedCriteria subMaxDate = DetachedCriteria.forClass(K8sPodsContainersEntity.class); subMaxDate.setProjection(Projections.max("statusDate")); Criteria crtCurrentCont = session.createCriteria(K8sPodsContainersEntity.class, "contSts"); crtCurrentCont.createCriteria("contSts.component", "component"); crtCurrentCont.add(Property.forName("statusDate").eq(subMaxDate)); DaoUtil.addEnvironmentToCriteria(envId, isParentComponents, comIdList, crtCurrentCont); crtCurrentCont.setProjection(Projections.sum("totalPods")); long currentNumOfCont = (long) (crtCurrentCont.uniqueResult() == null ? (long)0 : crtCurrentCont.uniqueResult()); session.close(); return currentNumOfCont; }
Example #8
Source File: RoleRepositoryImpl.java From AIDR with GNU Affero General Public License v3.0 | 6 votes |
@Override public Role findByRoleType(RoleType roleType) { Role role = null; try { Criteria criteria = getHibernateTemplate().getSessionFactory() .getCurrentSession().createCriteria(Role.class); Criterion criterion = Restrictions.eq("roleType", roleType); criteria.add(criterion); role = (Role) criteria.uniqueResult(); } catch(Exception e) { logger.error("Error in fetching data by roleType : " +roleType, e); } return role; }
Example #9
Source File: ConfidenceStatisticsResourceFacadeImp.java From AIDR with GNU Affero General Public License v3.0 | 6 votes |
@Override public List<ConfidenceData> getDataAfterTimestampInBin(String crisisCode, String attributeCode, String labelCode, Long timestamp, Integer bin) { Criteria criteria = getCurrentSession().createCriteria(ConfidenceData.class); Criterion criterion = Restrictions.conjunction() .add(Restrictions.eq("crisisCode", crisisCode)) .add(Restrictions.eq("attributeCode", attributeCode)) .add(Restrictions.eq("labelCode", labelCode)) .add(Restrictions.ge("timestamp", timestamp)) .add(Restrictions.eq("bin", bin)); criteria.add(criterion); try { List<ConfidenceData> objList = (List<ConfidenceData>) criteria.list(); return objList; } catch (HibernateException e) { logger.error("exception", e); e.printStackTrace(); } return null; }
Example #10
Source File: MessageBundleServiceImpl.java From sakai with Educational Community License v2.0 | 6 votes |
@Transactional(readOnly = true) public List<MessageBundleProperty> getAllProperties(String locale, String basename, String module) { Criteria query = sessionFactory.getCurrentSession().createCriteria(MessageBundleProperty.class); query.setCacheable(true); if (StringUtils.isNotEmpty(locale)) { query.add(Restrictions.eq("locale", locale)); } if (StringUtils.isNotEmpty(basename)) { query.add(Restrictions.eq("baseName", basename)); } if (StringUtils.isNotEmpty(module)) { query.add(Restrictions.eq("moduleName", module)); } return (List<MessageBundleProperty>) query.list(); }
Example #11
Source File: ConfidenceStatisticsResourceFacadeImp.java From AIDR with GNU Affero General Public License v3.0 | 6 votes |
@Override public List<ConfidenceData> getDataBeforeTimestampGranularityWithBin(String crisisCode, String attributeCode, String labelCode, Long timestamp, Long granularity, Integer bin) { Criteria criteria = getCurrentSession().createCriteria(ConfidenceData.class); Criterion criterion = Restrictions.conjunction() .add(Restrictions.eq("crisisCode", crisisCode)) .add(Restrictions.eq("attributeCode", attributeCode)) .add(Restrictions.eq("labelCode", labelCode)) .add(Restrictions.le("timestamp", timestamp)) .add(Restrictions.eq("granularity", granularity)) .add(Restrictions.ge("bin", bin)); criteria.add(criterion); try { List<ConfidenceData> objList = (List<ConfidenceData>) criteria.list(); return objList; } catch (HibernateException e) { logger.error("exception", e); e.printStackTrace(); } return null; }
Example #12
Source File: SearchContentsByName.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
@Override public Criteria evaluate(Session session) { Criteria c = session.createCriteria(SbiGlContents.class); c.setProjection(Projections.projectionList().add(Projections.property("contentId"), "contentId").add(Projections.property("contentNm"), "contentNm")) .setResultTransformer(Transformers.aliasToBean(SbiGlContents.class)); if (cont != null && !cont.isEmpty()) { c.add(Restrictions.eq("contentNm", cont).ignoreCase()); } return c; }
Example #13
Source File: SbiMetaTableColumnDAOHibImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
@Override public void modifyTableColumn(Session session, SbiMetaTableColumn aMetaTableColumn) throws EMFUserError { logger.debug("IN"); Session tmpSession = session; try { SbiMetaTableColumn hibMeta = (SbiMetaTableColumn) tmpSession.load(SbiMetaTableColumn.class, aMetaTableColumn.getColumnId()); hibMeta.setName(aMetaTableColumn.getName()); hibMeta.setType(aMetaTableColumn.getType()); hibMeta.setDeleted(aMetaTableColumn.isDeleted()); SbiMetaTable metaTable = null; if (aMetaTableColumn.getSbiMetaTable().getTableId() < 0) { Criterion aCriterion = Expression.eq("valueId", aMetaTableColumn.getSbiMetaTable().getTableId()); Criteria criteria = tmpSession.createCriteria(SbiMetaSource.class); criteria.add(aCriterion); metaTable = (SbiMetaTable) criteria.uniqueResult(); if (metaTable == null) { throw new SpagoBIDAOException("The SbiMetaTable with id= " + aMetaTableColumn.getSbiMetaTable().getTableId() + " does not exist"); } hibMeta.setSbiMetaTable(metaTable); } updateSbiCommonInfo4Update(hibMeta); } catch (HibernateException he) { logException(he); throw new HibernateException(he); } finally { logger.debug("OUT"); } }
Example #14
Source File: CriteriaQueryTranslator.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Get the a typed value for the given property value. */ public TypedValue getTypedValue(Criteria subcriteria, String propertyName, Object value) throws HibernateException { // Detect discriminator values... if ( value instanceof Class ) { Class entityClass = ( Class ) value; Queryable q = SessionFactoryHelper.findQueryableUsingImports( sessionFactory, entityClass.getName() ); if ( q != null ) { Type type = q.getDiscriminatorType(); String stringValue = q.getDiscriminatorSQLValue(); // Convert the string value into the proper type. if ( type instanceof NullableType ) { NullableType nullableType = ( NullableType ) type; value = nullableType.fromStringValue( stringValue ); } else { throw new QueryException( "Unsupported discriminator type " + type ); } return new TypedValue( type, value, EntityMode.POJO ); } } // Otherwise, this is an ordinary value. return new TypedValue( getTypeUsingProjection( subcriteria, propertyName ), value, EntityMode.POJO ); }
Example #15
Source File: StatsManagerImpl.java From sakai with Educational Community License v2.0 | 5 votes |
@Deprecated public List<EventStat> getEventStats(final String siteId, final List<String> events, final String searchKey, final Date iDate, final Date fDate) { if(siteId == null){ throw new IllegalArgumentException("Null siteId"); }else{ final List<String> userIdList = searchUsers(searchKey, siteId); /* return if no users matched */ if(userIdList != null && userIdList.size() == 0) return new ArrayList<EventStat>(); HibernateCallback<List<EventStat>> hcb = session -> { Criteria c = session.createCriteria(EventStatImpl.class) .add(Expression.eq("siteId", siteId)) .add(Expression.in("eventId", events)); if(!showAnonymousAccessEvents) c.add(Expression.ne("userId", EventTrackingService.UNKNOWN_USER)); if(userIdList != null && userIdList.size() > 0) c.add(Expression.in("userId", userIdList)); if(iDate != null) c.add(Expression.ge("date", iDate)); if(fDate != null){ // adjust final date Calendar ca = Calendar.getInstance(); ca.setTime(fDate); ca.add(Calendar.DAY_OF_YEAR, 1); Date fDate2 = ca.getTime(); c.add(Expression.lt("date", fDate2)); } return c.list(); }; return getHibernateTemplate().execute(hcb); } }
Example #16
Source File: InventoryDaoImpl.java From ctsms with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected Collection<Inventory> handleFindByIdDepartment(Long inventoryId, Long departmentId, PSFVO psf) throws Exception { org.hibernate.Criteria inventoryCriteria = createInventoryCriteria(); SubCriteriaMap criteriaMap = new SubCriteriaMap(Inventory.class, inventoryCriteria); CriteriaUtil.applyIdDepartmentCriterion(inventoryCriteria, inventoryId, departmentId); CriteriaUtil.applyPSFVO(criteriaMap, psf); return inventoryCriteria.list(); }
Example #17
Source File: SignupMeetingDaoImpl.java From sakai with Educational Community License v2.0 | 5 votes |
@SuppressWarnings("unchecked") public List<SignupMeeting> getSignupMeetingsInSite(String siteId, Date startDate, Date endDate) { DetachedCriteria criteria = DetachedCriteria.forClass( SignupMeeting.class).setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY) .add(Restrictions.ge("endTime", startDate)) .add(Restrictions.lt("startTime", endDate)) .addOrder(Order.asc("startTime")).createCriteria("signupSites") .add(Restrictions.eq("siteId", siteId)); return (List<SignupMeeting>) getHibernateTemplate().findByCriteria(criteria); }
Example #18
Source File: CriteriaQueryTranslator.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
/** * Get the names of the columns constrained * by this criterion. */ public String[] getColumnsUsingProjection( Criteria subcriteria, String propertyName) throws HibernateException { //first look for a reference to a projection alias final Projection projection = rootCriteria.getProjection(); String[] projectionColumns = projection == null ? null : projection.getColumnAliases( propertyName, 0 ); if ( projectionColumns == null ) { //it does not refer to an alias of a projection, //look for a property try { return getColumns( propertyName, subcriteria ); } catch ( HibernateException he ) { //not found in inner query , try the outer query if ( outerQueryTranslator != null ) { return outerQueryTranslator.getColumnsUsingProjection( subcriteria, propertyName ); } else { throw he; } } } else { //it refers to an alias of a projection return projectionColumns; } }
Example #19
Source File: MoneyTransferDaoImpl.java From ctsms with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected Collection<String> handleGetCostTypes(Long trialDepartmentId, Long trialId, Long probandDepartmentId, Long probandId, PaymentMethod method) throws Exception { org.hibernate.Criteria moneyTransferCriteria = createMoneyTransferCriteria("moneyTransfer"); if (method != null) { moneyTransferCriteria.add(Restrictions.eq("method", method)); } applyCostTypeCriterions(moneyTransferCriteria, trialDepartmentId, trialId, probandDepartmentId, probandId); moneyTransferCriteria.setProjection(Projections.distinct(Projections.property("costType"))); List<String> result = moneyTransferCriteria.list(); Collections.sort(result, ServiceUtil.MONEY_TRANSFER_COST_TYPE_COMPARATOR); // match TreeMaps! return result; }
Example #20
Source File: CriteriaQueryTranslator.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Type getTypeUsingProjection(Criteria subcriteria, String propertyName) throws HibernateException { //first look for a reference to a projection alias final Projection projection = rootCriteria.getProjection(); Type[] projectionTypes = projection == null ? null : projection.getTypes( propertyName, subcriteria, this ); if ( projectionTypes == null ) { try { //it does not refer to an alias of a projection, //look for a property return getType( subcriteria, propertyName ); } catch ( HibernateException he ) { //not found in inner query , try the outer query if ( outerQueryTranslator != null ) { return outerQueryTranslator.getType( subcriteria, propertyName ); } else { throw he; } } } else { if ( projectionTypes.length != 1 ) { //should never happen, i think throw new QueryException( "not a single-length projection: " + propertyName ); } return projectionTypes[0]; } }
Example #21
Source File: AbstractDao.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") public List findAll() { Criteria criteria = getCurrentSession().createCriteria(entityClass); criteria.setProjection(Projections.distinct(Projections.property("id"))); try { List result = criteria.list(); //System.out.println("result = " + result); return result; } catch (HibernateException e) { logger.error("Error in findAll().",e); return null; } }
Example #22
Source File: CollectionRepositoryImpl.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public List<Collection> searchByName(String query, Long userId) throws Exception { Criteria criteria = getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(Collection.class); criteria.add(Restrictions.ilike("name", query, MatchMode.ANYWHERE)); criteria.add(Restrictions.eq("owner.id", userId)); return criteria.list(); }
Example #23
Source File: AbstractHibernateCriteriaBuilder.java From gorm-hibernate5 with Apache License 2.0 | 5 votes |
/** * Creates a Criterion that contrains a collection property to be less than or equal to the given size * * @param propertyName The property name * @param size The size to constrain by * * @return A Criterion instance */ public org.grails.datastore.mapping.query.api.Criteria sizeLe(String propertyName, int size) { if (!validateSimpleExpression()) { throwRuntimeException(new IllegalArgumentException("Call to [sizeLe] with propertyName [" + propertyName + "] and size [" + size + "] not allowed here.")); } propertyName = calculatePropertyName(propertyName); addToCriteria(Restrictions.sizeLe(propertyName, size)); return this; }
Example #24
Source File: GenericBaseCommonDao.java From jeewx with Apache License 2.0 | 5 votes |
/** * 返回easyui datagrid DataGridReturn模型对象 */ public DataGridReturn getDataGridReturn(final CriteriaQuery cq, final boolean isOffset) { Criteria criteria = cq.getDetachedCriteria().getExecutableCriteria( getSession()); CriteriaImpl impl = (CriteriaImpl) criteria; // 先把Projection和OrderBy条件取出来,清空两者来执行Count操作 Projection projection = impl.getProjection(); final int allCounts = ((Long) criteria.setProjection( Projections.rowCount()).uniqueResult()).intValue(); criteria.setProjection(projection); if (projection == null) { criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY); } if (StringUtils.isNotBlank(cq.getDataGrid().getSort())) { cq.addOrder(cq.getDataGrid().getSort(), cq.getDataGrid().getOrder()); } // 判断是否有排序字段 if (!cq.getOrdermap().isEmpty()) { cq.setOrder(cq.getOrdermap()); } int pageSize = cq.getPageSize();// 每页显示数 int curPageNO = PagerUtil.getcurPageNo(allCounts, cq.getCurPage(), pageSize);// 当前页 int offset = PagerUtil.getOffset(allCounts, curPageNO, pageSize); if (isOffset) {// 是否分页 criteria.setFirstResult(offset); criteria.setMaxResults(cq.getPageSize()); } else { pageSize = allCounts; } // DetachedCriteriaUtil.selectColumn(cq.getDetachedCriteria(), // cq.getField().split(","), cq.getClass1(), false); List list = criteria.list(); cq.getDataGrid().setResults(list); cq.getDataGrid().setTotal(allCounts); return new DataGridReturn(allCounts, list); }
Example #25
Source File: GenericDaoImpl.java From olat with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public List<T> findByCriteria(Map<String, Object> restrictionNameValues) { Criteria criteria = getCurrentSession().createCriteria(type); Iterator<String> keys = restrictionNameValues.keySet().iterator(); while (keys.hasNext()) { String restrictionName = keys.next(); Object restrictionValue = restrictionNameValues.get(restrictionName); criteria = criteria.add(Restrictions.eq(restrictionName, restrictionValue)); } criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return criteria.list(); }
Example #26
Source File: AlertSubscribeDaoImpl.java From kardio with Apache License 2.0 | 5 votes |
/** * Function to get all global subscriptions from the database */ @Override public List<AlertSubscriptionEntity> getAllGlobalSubscriptions() { Session session = sessionFactory.openSession(); Criteria aseCriteria = session.createCriteria(AlertSubscriptionEntity.class); aseCriteria.add(Restrictions.isNull("component")); @SuppressWarnings("unchecked") List<AlertSubscriptionEntity> alertSubscriptionList = (List<AlertSubscriptionEntity>) aseCriteria.list(); session.close(); return alertSubscriptionList; }
Example #27
Source File: HibernateUtil.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
@Deprecated @SuppressWarnings("unchecked") public static List<ComplexRule> searchComplex(String row, String text) { text = "%" + text + "%"; Session session = getSessionFactory().getCurrentSession(); session.beginTransaction(); Criteria crit = session.createCriteria(ComplexRule.class); List<ComplexRule> rules = crit.add(Restrictions.and(Restrictions.eq(PUBLISHED, true), Restrictions.ilike(row, text))).list(); session.getTransaction().commit(); return rules; }
Example #28
Source File: DatabaseAccess.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private static List<TimeseriesFeed> findTimeseriesFeedsWith(TimeseriesMetadata timeseriesMetadata, Session session) { Criteria criteria = session.createCriteria(TimeseriesFeed.class); List<TimeseriesFeed> timeseriesFeeds = criteria .add(Restrictions.eq("timeseriesId", timeseriesMetadata.getTimeseriesId())) // .add(Restrictions.eq("serviceUrl", timeseriesMetadata.getServiceUrl())) // .add(Restrictions.eq("phenomenon", timeseriesMetadata.getPhenomenon())) // .add(Restrictions.eq("procedure", timeseriesMetadata.getProcedure())) // .add(Restrictions.eq("offering", timeseriesMetadata.getOffering())) // .add(Restrictions.eq("featureOfInterest", timeseriesMetadata.getFeatureOfInterest())) .list(); return timeseriesFeeds; }
Example #29
Source File: CriteriaQueryTranslator.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public String getColumn(Criteria criteria, String propertyName) { String[] cols = getColumns( propertyName, criteria ); if ( cols.length != 1 ) { throw new QueryException( "property does not map to a single column: " + propertyName ); } return cols[0]; }
Example #30
Source File: ReportDaoImpl.java From Spring-MVC-Blueprints with MIT License | 5 votes |
@Transactional @Override public Tblfaculty getFacultyId(String username) { Session session = this.sessionFactory.getCurrentSession(); Criteria crit = session.createCriteria(Tblfaculty.class); crit.add(Restrictions.like("username",username)); List<Tblfaculty> faculty = crit.list(); return faculty.get(0); }