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.Entity;
11  import javax.persistence.GeneratedValue;
12  import javax.persistence.GenerationType;
13  import javax.persistence.Id;
14  import javax.persistence.Version;
15  
16  import org.hibernate.annotations.Cache;
17  import org.hibernate.annotations.CacheConcurrencyStrategy;
18  
19  import com.hack23.cia.model.core.impl.BaseEntity;
20  
21  /***
22   * The Class GameBoard.
23   */
24  @Entity
25  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
26  public class GameBoard extends BaseEntity {
27  
28      /*** The Constant serialVersionUID. */
29      private static final long serialVersionUID = -1381199844545595026L;
30  
31      /*** The id. */
32      private Long id;
33  
34  
35      /*** The players. */
36      private Set<Player> players;
37      
38      /*** The version. */
39      private Long version=1L;
40  
41      /***
42       * Instantiates a new game board.
43       */
44      public GameBoard() {
45      }
46  
47      /*
48       * (non-Javadoc)
49       * 
50       * @see com.hack23.cia.model.core.BaseEntity#getId()
51       */
52      @Override
53      @Id
54      @GeneratedValue(strategy = GenerationType.AUTO)
55      public Long getId() {
56          return id;
57      }
58  
59  
60      /* (non-Javadoc)
61       * @see com.hack23.cia.model.core.BaseEntity#getVersion()
62       */
63      @Override
64      @Version
65      public Long getVersion() {
66          return version;
67      }
68  
69      /***
70       * Sets the id.
71       *
72       * @param id the new id
73       */
74      public void setId(final Long id) {
75          this.id = id;
76      }
77  
78      /***
79       * Sets the version.
80       *
81       * @param version the new version
82       */
83      public void setVersion(final Long version) {
84          this.version = version;
85      }
86  }