Game.java 2.22 KB
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fi.codecrew.moya.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;

/**
 * 
 */
@Entity
@Table(name = "games")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Game extends GenericEntity {

    private static final long serialVersionUID = 1L;

    

    @Column(name = "name")
     private String name;
    
    @Column(name = "service")
    private String service;

    @Column(name = "description")
    private  String description;
    
    @Column(name = "code_url")
    private  String codeUrl;
    

    @JoinColumn(name = "event_id", referencedColumnName = "id")
    @ManyToOne
    private LanEvent event;
    
    @OneToMany(mappedBy = "game", fetch = FetchType.LAZY)
    @OrderBy()
    private List<GameCode> gameCodes;
    
    
    




    public Game() {
        super();
    }




    public String getName() {
        return name;
    }




    public void setName(String name) {
        this.name = name;
    }




    public String getDescription() {
        return description;
    }




    public void setDescription(String description) {
        this.description = description;
   }
    

    public String getCodeUrl() {
        return codeUrl;
    }




    public void setCodeUrl(String codeUrl) {
        this.codeUrl = codeUrl;
    }




    public LanEvent getEvent() {
        return event;
    }




    public void setEvent(LanEvent event) {
        this.event = event;
    }




    public String getService() {
        return service;
    }




    public void setService(String service) {
        this.service = service;
    }




    public List<GameCode> getGameCodes() {
        return gameCodes;
    }




    public void setGameCodes(List<GameCode> gameCodes) {
        this.gameCodes = gameCodes;
    }


}