View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling 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. 
3   	$Id
4   */
5   
6   package com.hack23.cia.model.application.impl.common;
7   
8   import java.util.Set;
9   
10  import javax.persistence.CascadeType;
11  import javax.persistence.Entity;
12  import javax.persistence.FetchType;
13  import javax.persistence.GeneratedValue;
14  import javax.persistence.GenerationType;
15  import javax.persistence.Id;
16  import javax.persistence.JoinTable;
17  import javax.persistence.OneToMany;
18  import javax.persistence.Version;
19  
20  import org.hibernate.annotations.Cache;
21  import org.hibernate.annotations.CacheConcurrencyStrategy;
22  
23  import com.hack23.cia.model.core.impl.BaseEntity;
24  
25  /***
26   * The Class PoliticalGame.
27   */
28  @Entity
29  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
30  public class PoliticalGame extends BaseEntity {
31  
32      /*** The Constant serialVersionUID. */
33      private static final long serialVersionUID = -1381199844545595026L;
34  
35      /*** The game boards. */
36      private Set<GameBoard> gameBoards;
37  
38  
39      /*** The id. */
40      private Long id;
41  
42      /*** The version. */
43      private Long version=1L;
44      
45      /***
46       * Instantiates a new political game.
47       */
48      public PoliticalGame() {
49      }
50  
51      /***
52       * Gets the game boards.
53       *
54       * @return the game boards
55       */
56      @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
57      @JoinTable(name = "PoliticalGameBoards")
58  	public Set<GameBoard> getGameBoards() {
59  		return gameBoards;
60  	}
61  
62  
63      /*
64       * (non-Javadoc)
65       * 
66       * @see com.hack23.cia.model.core.BaseEntity#getId()
67       */
68      @Override
69      @Id
70      @GeneratedValue(strategy = GenerationType.AUTO)
71      public Long getId() {
72          return id;
73      }
74  
75      /* (non-Javadoc)
76       * @see com.hack23.cia.model.core.BaseEntity#getVersion()
77       */
78      @Override
79      @Version
80      public Long getVersion() {
81          return version;
82      }
83  
84      /***
85       * Sets the game boards.
86       *
87       * @param gameBoards the new game boards
88       */
89  	public void setGameBoards(final Set<GameBoard> gameBoards) {
90  		this.gameBoards = gameBoards;
91  	}
92  
93  	/***
94  	 * Sets the id.
95  	 *
96  	 * @param id the new id
97  	 */
98      public void setId(final Long id) {
99          this.id = id;
100     }
101 
102 	/***
103 	 * Sets the version.
104 	 *
105 	 * @param version the new version
106 	 */
107     public void setVersion(final Long version) {
108         this.version = version;
109     }
110 }