[jboss-cvs] jboss-seam/examples/contactlist/src/org/jboss/seam/example/contactlist ...
Gavin King
gavin.king at jboss.com
Fri Oct 27 09:42:45 EDT 2006
User: gavin
Date: 06/10/27 09:42:45
Added: examples/contactlist/src/org/jboss/seam/example/contactlist
Comment.java Contact.java
Log:
tests
Revision Changes Path
1.1 date: 2006/10/27 13:42:45; author: gavin; state: Exp;jboss-seam/examples/contactlist/src/org/jboss/seam/example/contactlist/Comment.java
Index: 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;
}
}
1.1 date: 2006/10/27 13:42:45; author: gavin; state: Exp;jboss-seam/examples/contactlist/src/org/jboss/seam/example/contactlist/Contact.java
Index: Contact.java
===================================================================
package org.jboss.seam.example.contactlist;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Version;
import org.hibernate.validator.Length;
@Entity
public class Contact
{
@Id @GeneratedValue
private Long id;
@Length(max=50)
private String firstName;
@Length(max=50)
private String lastName;
@Length(max=250)
private String address;
@Length(max=50)
private String city;
@Length(max=50)
private String state;
@Length(max=6)
private String zip;
@Length(max=50)
private String country;
@Length(max=20)
private String homePhone;
@Length(max=20)
private String businessPhone;
@Length(max=20)
private String cellPhone;
@Version
private int version;
@OneToMany(mappedBy="contact", cascade=CascadeType.REMOVE)
@OrderBy("created")
private List<Comment> comments = new ArrayList<Comment>();
public String getAddress()
{
return address;
}
public void setAddress(String address)
{
this.address = address;
}
public String getBusinessPhone()
{
return businessPhone;
}
public void setBusinessPhone(String businessPhone)
{
this.businessPhone = businessPhone;
}
public String getCellPhone()
{
return cellPhone;
}
public void setCellPhone(String cellPhone)
{
this.cellPhone = cellPhone;
}
public String getCity()
{
return city;
}
public void setCity(String city)
{
this.city = city;
}
public String getCountry()
{
return country;
}
public void setCountry(String country)
{
this.country = country;
}
public String getFirstName()
{
return firstName;
}
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
public String getHomePhone()
{
return homePhone;
}
public void setHomePhone(String homePhone)
{
this.homePhone = homePhone;
}
public String getLastName()
{
return lastName;
}
public void setLastName(String lastName)
{
this.lastName = lastName;
}
public String getState()
{
return state;
}
public void setState(String state)
{
this.state = state;
}
public String getZip()
{
return zip;
}
public void setZip(String zip)
{
this.zip = zip;
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public List<Comment> getComments()
{
return comments;
}
}
More information about the jboss-cvs-commits
mailing list