Comment.java :  » JBoss » jboss-seam-2.2.0 » org » jboss » seam » example » contactlist » Java Open Source

Java Open Source » JBoss » jboss seam 2.2.0 
jboss seam 2.2.0 » org » jboss » seam » example » contactlist » Comment.java
package org.jboss.seam.example.contactlist;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

@Entity
public class Comment
{
   @Id @GeneratedValue 
   private Long id;
   
   @NotNull @ManyToOne
   private Contact contact;
   
   @NotNull @Length(max=1500)
   private String text;
   
   @NotNull
   private Date created;

   public Contact getContact()
   {
      return contact;
   }

   public void setContact(Contact contact)
   {
      this.contact = contact;
      contact.getComments().add(this);
   }

   public Long getId()
   {
      return id;
   }

   public String getText()
   {
      return text;
   }

   public void setText(String text)
   {
      this.text = text;
   }

   public Date getCreated()
   {
      return created;
   }

   public void setCreated(Date created)
   {
      this.created = created;
   }  

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.