View Javadoc
1   /*
2    * Copyright 2010 James Pether Sörling
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   *	$Id$
17   *  $HeadURL$
18  */
19  package com.hack23.cia.service.data.impl;
20  
21  import java.util.List;
22  
23  import javax.persistence.criteria.CriteriaQuery;
24  import javax.persistence.criteria.Root;
25  
26  import org.springframework.stereotype.Repository;
27  
28  import com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenCommitteeEmbeddedId;
29  import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee;
30  import com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee_;
31  import com.hack23.cia.service.data.api.ViewRiksdagenCommitteeDAO;
32  
33  /**
34   * The Class ViewRiksdagenCommitteeDAOImpl.
35   */
36  @Repository("ViewRiksdagenCommitteeDAO")
37  final class ViewRiksdagenCommitteeDAOImpl
38  		extends
39  		AbstractGenericDAOImpl<ViewRiksdagenCommittee, RiksdagenCommitteeEmbeddedId>
40  		implements ViewRiksdagenCommitteeDAO {
41  
42  	/**
43  	 * Instantiates a new view riksdagen committee dao impl.
44  	 */
45  	public ViewRiksdagenCommitteeDAOImpl() {
46  		super(ViewRiksdagenCommittee.class);
47  	}
48  
49  	@Override
50  	public List<RiksdagenCommitteeEmbeddedId> getIdList() {
51  		final CriteriaQuery<RiksdagenCommitteeEmbeddedId> criteria = getCriteriaBuilder()
52  				.createQuery(RiksdagenCommitteeEmbeddedId.class);
53  		final Root<ViewRiksdagenCommittee> root = criteria
54  				.from(ViewRiksdagenCommittee.class);
55  		criteria.select(getCriteriaBuilder().construct(
56  				RiksdagenCommitteeEmbeddedId.class,
57  				root.get(ViewRiksdagenCommittee_.embeddedId)));
58  		return getEntityManager().createQuery(criteria).getResultList();
59  	}
60  
61  }