001package ball.game.crossword.entity; 002/*- 003 * ########################################################################## 004 * Game Applications and Utilities 005 * %% 006 * Copyright (C) 2010 - 2022 Allen D. Ball 007 * %% 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 * ########################################################################## 020 */ 021import java.util.ArrayList; 022import java.util.List; 023import javax.persistence.Column; 024import javax.persistence.Entity; 025import javax.persistence.GeneratedValue; 026import javax.persistence.Id; 027import javax.persistence.Lob; 028import javax.persistence.ManyToOne; 029import javax.persistence.OneToMany; 030import javax.persistence.Table; 031import lombok.EqualsAndHashCode; 032import lombok.Getter; 033import lombok.NoArgsConstructor; 034import lombok.Setter; 035import lombok.ToString; 036 037import static javax.persistence.CascadeType.ALL; 038import static javax.persistence.FetchType.LAZY; 039import static javax.persistence.GenerationType.IDENTITY; 040 041/** 042 * {@link Crossword} {@link Entity}. 043 * 044 * {@bean.info} 045 * 046 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball} 047 */ 048@Entity 049@Table(catalog = "crossword", name = "crossword") 050@NoArgsConstructor @EqualsAndHashCode(callSuper = false) @ToString 051public class Crossword extends AbstractEntity { 052 @Id @GeneratedValue(strategy = IDENTITY) 053 private long id = -1; 054 055 @OneToMany(mappedBy = "crossword", cascade = ALL) 056 @Getter @Setter 057 private List<Header> headers = new ArrayList<>(); 058 059 @ManyToOne(fetch = LAZY) 060 @Getter @Setter 061 private Grid grid = null; 062 063 @OneToMany(mappedBy = "crossword", cascade = ALL) 064 @Getter @Setter 065 private List<Clue> clues = new ArrayList<>(); 066 067 @Column @Lob 068 @Getter @Setter 069 private String notes = null; 070}