/* * Copyright (c) 2018. Developed by Hedgecode. * * 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. */ package org.hedgecode.chess.domain; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; /** * * * @author Dmitry Samoshin aka gotty */ @Entity @Table( name = "etude_types" ) @NamedQueries({ @NamedQuery( name = EtudeType.FIND_ALL, query = "select et from EtudeType et" ), @NamedQuery( name = EtudeType.FIND_BY_ID, query = "select et from EtudeType et where et.id = :id" ), @NamedQuery( name = EtudeType.FIND_BY_BRIEF, query = "select et from EtudeType et where et.brief = :brief" ) }) public class EtudeType extends DomainObject { public static final String FIND_ALL = "EtudeType.findAll"; public static final String FIND_BY_ID = "EtudeType.findById"; public static final String FIND_BY_BRIEF = "EtudeType.findByBrief"; public static final String BRIEF_PARAMETER = "brief"; @Id @Column( name = "f_id" ) @GeneratedValue( strategy = GenerationType.AUTO ) private Long id; @Column( name = "f_brief", nullable = false ) private String brief; @Column( name = "f_name", nullable = false ) private String name; @Column( name = "f_description" ) private String description; public TargetType assemble(TargetType target, EtudeTypeAdapter adapter) { adapter.setId(target, id); adapter.setBrief(target, brief); adapter.setName(target, name); adapter.setDescription(target, description); return target; } @Override public Long getId() { return id; } }