Java tutorial
package edu.uiowa.icts.bluebutton.dao; /* * #%L * blue-button Spring MVC Web App * %% * Copyright (C) 2014 - 2015 University of Iowa Institute for Clinical and Translational Science (ICTS) * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import java.util.HashMap; import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hibernate.Criteria; import org.hibernate.criterion.Disjunction; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import edu.uiowa.icts.bluebutton.domain.LabResultSynonym; import edu.uiowa.icts.spring.GenericDao; /** * Generated by Protogen * @since 04/14/2015 11:40:13 CDT */ @Repository("edu_uiowa_icts_bluebutton_dao_LabResultSynonymHome") @Transactional public class LabResultSynonymHome extends GenericDao<LabResultSynonym> implements LabResultSynonymService { private static final Log log = LogFactory.getLog(LabResultSynonymHome.class); public LabResultSynonymHome() { setDomainName("edu.uiowa.icts.bluebutton.domain.LabResultSynonym"); } public LabResultSynonym findById(Integer id) { return (LabResultSynonym) this.sessionFactory.getCurrentSession().get(LabResultSynonym.class, id); } //list should be set public List<LabResultSynonym> getSynonym(Set<String> set) { if (set.size() > 0) { Criteria criteria = this.sessionFactory.getCurrentSession().createCriteria(LabResultSynonym.class); Disjunction d = Restrictions.disjunction(); for (String unofficialName : set) { d.add(Restrictions.eq("unofficialName", unofficialName.trim()).ignoreCase()); } List<LabResultSynonym> lrsList = (List<LabResultSynonym>) criteria.list(); return (List<LabResultSynonym>) criteria.list(); } return null; } }