2 * Copyright (c) 2018. Developed by Hedgecode.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.hedgecode.chess.service.jpa;
19 import java.util.List;
21 import javax.persistence.Query;
23 import org.hedgecode.chess.domain.EtudeType;
24 import org.hedgecode.chess.service.EtudeTypeService;
29 * @author Dmitry Samoshin aka gotty
31 public class JpaEtudeTypeService extends JpaDomainService<EtudeType> implements EtudeTypeService {
33 private static final long DEFAULT_ID = 1;
39 public List<EtudeType> findAll() {
40 return getEntityManager().createNamedQuery(
49 public EtudeType findById(Long id) {
50 Query query = getEntityManager().createNamedQuery(
53 query.setParameter(EtudeType.ID_PROPERTY, id);
54 return (EtudeType) query.getSingleResult();
61 public EtudeType findByBrief(String brief) {
62 Query query = getEntityManager().createNamedQuery(
63 EtudeType.FIND_BY_BRIEF
65 query.setParameter(EtudeType.BRIEF_PROPERTY, brief);
66 return (EtudeType) query.getSingleResult();
73 public EtudeType findDefault() {