// Path: src/main/java/org/lbogdanov/poker/core/Constants.java
// public static final int SESSION_CODE_MAX_LENGTH = 32;
// 
// Path: src/main/java/org/lbogdanov/poker/core/Constants.java
// public static final int SESSION_DESCRIPTION_MAX_LENGTH = 4096;
// 
// Path: src/main/java/org/lbogdanov/poker/core/Constants.java
// public static final int SESSION_ESTIMATES_MAX_LENGTH = 1024;
// 
// Path: src/main/java/org/lbogdanov/poker/core/Constants.java
// public static final int SESSION_NAME_MAX_LENGTH = 128;


import static org.lbogdanov.poker.core.Constants.SESSION_CODE_MAX_LENGTH;
import static org.lbogdanov.poker.core.Constants.SESSION_DESCRIPTION_MAX_LENGTH;
import static org.lbogdanov.poker.core.Constants.SESSION_ESTIMATES_MAX_LENGTH;
import static org.lbogdanov.poker.core.Constants.SESSION_NAME_MAX_LENGTH;
import java.util.Date;
import javax.persistence.*;
import com.google.common.base.Objects;
/**
 * Copyright 2012 Leonid Bogdanov
 *
 * 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.lbogdanov.poker.core;






/**
 * Represents a Planning Poker session.
 * 
 * @author Leonid Bogdanov
 */
@Entity
@Table(name = "SESSIONS")
public class Session extends AbstractEntity {

    @Column(name = "NAME", length = SESSION_NAME_MAX_LENGTH, nullable = false)
    private String name = "";
    @Column(name = "CODE", length = SESSION_CODE_MAX_LENGTH, nullable = false, unique = true)
    private String code = "";
    @Column(name = "CREATED", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date created = new Date();
    @Column(name = "DESCRIPTION", length = SESSION_DESCRIPTION_MAX_LENGTH, nullable = true)
    private String description = "";
    @ManyToOne(optional = false)
    @JoinColumn(name = "AUTHOR_ID", nullable = false)
    private User author;
// Path: src/main/java/org/lbogdanov/poker/core/Constants.java
// public static final int SESSION_CODE_MAX_LENGTH = 32;
// 
// Path: src/main/java/org/lbogdanov/poker/core/Constants.java
// public static final int SESSION_DESCRIPTION_MAX_LENGTH = 4096;
// 
// Path: src/main/java/org/lbogdanov/poker/core/Constants.java
// public static final int SESSION_ESTIMATES_MAX_LENGTH = 1024;
// 
// Path: src/main/java/org/lbogdanov/poker/core/Constants.java
// public static final int SESSION_NAME_MAX_LENGTH = 128;


// Path: src/main/java/org/lbogdanov/poker/core/Session.java
import static org.lbogdanov.poker.core.Constants.SESSION_CODE_MAX_LENGTH;
import static org.lbogdanov.poker.core.Constants.SESSION_DESCRIPTION_MAX_LENGTH;
import static org.lbogdanov.poker.core.Constants.SESSION_ESTIMATES_MAX_LENGTH;
import static org.lbogdanov.poker.core.Constants.SESSION_NAME_MAX_LENGTH;
import java.util.Date;
import javax.persistence.*;
import com.google.common.base.Objects;

/**
 * Copyright 2012 Leonid Bogdanov
 *
 * 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.lbogdanov.poker.core;






/**
 * Represents a Planning Poker session.
 * 
 * @author Leonid Bogdanov
 */
@Entity
@Table(name = "SESSIONS")
public class Session extends AbstractEntity {

    @Column(name = "NAME", length = SESSION_NAME_MAX_LENGTH, nullable = false)
    private String name = "";
    @Column(name = "CODE", length = SESSION_CODE_MAX_LENGTH, nullable = false, unique = true)
    private String code = "";
    @Column(name = "CREATED", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date created = new Date();
    @Column(name = "DESCRIPTION", length = SESSION_DESCRIPTION_MAX_LENGTH, nullable = true)
    private String description = "";
    @ManyToOne(optional = false)
    @JoinColumn(name = "AUTHOR_ID", nullable = false)
    private User author;
    @Column(name = "ESTIMATES", length = SESSION_ESTIMATES_MAX_LENGTH, nullable = false)