[jboss-cvs] jboss-seam/examples/ui/src/org/jboss/seam/example/ui ...

Peter Muir peter at bleepbleep.org.uk
Fri Mar 23 18:25:59 EDT 2007


  User: pmuir   
  Date: 07/03/23 18:25:59

  Modified:    examples/ui/src/org/jboss/seam/example/ui   Person.java
  Added:       examples/ui/src/org/jboss/seam/example/ui   Picture.java
  Log:
  oops
  
  Revision  Changes    Path
  1.6       +24 -1     jboss-seam/examples/ui/src/org/jboss/seam/example/ui/Person.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Person.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/ui/src/org/jboss/seam/example/ui/Person.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- Person.java	22 Mar 2007 13:07:18 -0000	1.5
  +++ Person.java	23 Mar 2007 22:25:59 -0000	1.6
  @@ -3,6 +3,7 @@
   import java.io.Serializable;
   import java.util.List;
   
  +import javax.persistence.CascadeType;
   import javax.persistence.Entity;
   import javax.persistence.EnumType;
   import javax.persistence.Enumerated;
  @@ -10,7 +11,7 @@
   import javax.persistence.Id;
   import javax.persistence.ManyToMany;
   import javax.persistence.ManyToOne;
  -import javax.persistence.OneToMany;
  +import javax.persistence.OneToOne;
   
   @Entity
   public class Person implements Serializable
  @@ -63,6 +64,14 @@
      @ManyToOne
      private Book favouriteBook;
   
  +   @OneToOne(cascade=CascadeType.ALL)
  +   private Picture picture;
  +   
  +   public Person()
  +   {
  +      picture = new Picture();
  +   }
  +
      public Country getCountry()
      {
         return country;
  @@ -152,4 +161,18 @@
      {
         this.hobbies = hobbies;
      }
  +   
  +   public Picture getPicture()
  +   {
  +      if (picture == null)
  +      {
  +         picture = new Picture();
  +      }
  +      return picture;
  +   }
  +   
  +   public void setPicture(Picture picture)
  +   {
  +      this.picture = picture;
  +   }
   }
  
  
  
  1.1      date: 2007/03/23 22:25:59;  author: pmuir;  state: Exp;jboss-seam/examples/ui/src/org/jboss/seam/example/ui/Picture.java
  
  Index: Picture.java
  ===================================================================
  package org.jboss.seam.example.ui;
  
  import java.io.Serializable;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  import javax.persistence.Lob;
  import javax.persistence.OneToOne;
  
  import org.jboss.seam.annotations.Name;
  
  @Entity
  @Name("memberImage")
  public class Picture implements Serializable
  {
     private static final long serialVersionUID = -8088455267213832920L;
     
     @Id @GeneratedValue
     private Integer id;
     
     @OneToOne(mappedBy="picture")
     private Person person;
     private byte[] data;
     private String contentType;
     private String fileName;
     
    
     public Integer getId()
     {
        return id;
     }
     
     public void setId(Integer imageId)
     {
        this.id = imageId;
     }
     
     
     public Person getPerson()
     {
        return person;
     }
     
     public void setPerson(Person person)
     {
        this.person = person;
     }
  
     public String getContentType()
     {
        return contentType;
     }
  
     public void setContentType(String contentType)
     {
        this.contentType = contentType;
     }
  
     @Lob
     public byte[] getData()
     {
        return data;
     }
  
     public void setData(byte[] data)
     {
        this.data = data;
     }
     
     public String getFileName()
     {
        return fileName;
     }
     
     public void setFileName(String fileName)
     {
        this.fileName = fileName;
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list