When you pull an object out of the database, Collections are not
ordinary java.util collections but are instead turned into ones that
can keep track of persistence data. You need to use something like
Gilead (http://noon.gilead.free.fr/gilead/), or Dozer with a DTO. If
your Object graph isn't very large, you can use Dozer to map the
object onto itself.

--
Arthur Kalmenson



On Sun, Apr 26, 2009 at 7:56 AM, Saeed Zarinfam <zarinfa...@gmail.com> wrote:
>
> this is my entity class.
>
> import java.io.Serializable;
> import javax.persistence.Basic;
> import javax.persistence.Column;
> import javax.persistence.Entity;
> import javax.persistence.FetchType;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
> import javax.persistence.JoinColumn;
> import javax.persistence.ManyToOne;
> import javax.persistence.NamedQueries;
> import javax.persistence.NamedQuery;
> import javax.persistence.Table;
>
> /**
>  *
>  * @author Saeed Zarinfam
>  */
> @Entity
> @Table(name = "ole_exam")
> @NamedQueries({...@namedquery(name = "Exam.findAll", query = "SELECT e
> FROM Exam e"), @NamedQuery(name = "Exam.findByExamId", query = "SELECT
> e FROM Exam e WHERE e.examId = :examId"), @NamedQuery(name =
> "Exam.findByExamName", query = "SELECT e FROM Exam e WHERE e.examName
> = :examName"), @NamedQuery(name = "Exam.findByExamDesc", query =
> "SELECT e FROM Exam e WHERE e.examDesc = :examDesc"), @NamedQuery(name
> = "Exam.findByExamTime", query = "SELECT e FROM Exam e WHERE
> e.examTime = :examTime"), @NamedQuery(name =
> "Exam.findByExamQuestionCount", query = "SELECT e FROM Exam e WHERE
> e.examQuestionCount = :examQuestionCount"), @NamedQuery(name =
> "Exam.findByExamMinMark", query = "SELECT e FROM Exam e WHERE
> e.examMinMark = :examMinMark")})
> public class Exam implements Serializable {
>    private static final long serialVersionUID = 1L;
>   �...@id
>   �...@generatedvalue(strategy = GenerationType.IDENTITY)
>   �...@basic(optional = false)
>   �...@column(name = "exam_id")
>    private Long examId;
>   �...@basic(optional = false)
>   �...@column(name = "exam_name")
>    private String examName;
>   �...@column(name = "exam_desc")
>    private String examDesc;
>   �...@basic(optional = false)
>   �...@column(name = "exam_time")
>    private short examTime;
>   �...@basic(optional = false)
>   �...@column(name = "exam_question_count")
>    private short examQuestionCount;
>   �...@basic(optional = false)
>   �...@column(name = "exam_min_mark")
>    private int examMinMark;
>   �...@joincolumn(name = "exam_template_fk", referencedColumnName =
> "exam_template_id")
>   �...@manytoone(optional = false, fetch = FetchType.LAZY)
>    private ExamTemplate examTemplateFk;
>
>    public Exam() {
>    }
>
>    public Exam(Long examId) {
>        this.examId = examId;
>    }
>
>    public Exam( String examName, short examTime, short
> examQuestionCount, int examMinMark) {
>        this.examName = examName;
>        this.examTime = examTime;
>        this.examQuestionCount = examQuestionCount;
>        this.examMinMark = examMinMark;
>    }
>
>    public Long getExamId() {
>        return examId;
>    }
>
>    public void setExamId(Long examId) {
>        this.examId = examId;
>    }
>
>    public String getExamName() {
>        return examName;
>    }
>
>    public void setExamName(String examName) {
>        this.examName = examName;
>    }
>
>    public String getExamDesc() {
>        return examDesc;
>    }
>
>    public void setExamDesc(String examDesc) {
>        this.examDesc = examDesc;
>    }
>
>    public short getExamTime() {
>        return examTime;
>    }
>
>    public void setExamTime(short examTime) {
>        this.examTime = examTime;
>    }
>
>    public short getExamQuestionCount() {
>        return examQuestionCount;
>    }
>
>    public void setExamQuestionCount(short examQuestionCount) {
>        this.examQuestionCount = examQuestionCount;
>    }
>
>    public int getExamMinMark() {
>        return examMinMark;
>    }
>
>    public void setExamMinMark(int examMinMark) {
>        this.examMinMark = examMinMark;
>    }
>
>    public ExamTemplate getExamTemplateFk() {
>        return examTemplateFk;
>    }
>
>    public void setExamTemplateFk(ExamTemplate examTemplateFk) {
>        this.examTemplateFk = examTemplateFk;
>    }
>
>   �...@override
>    public int hashCode() {
>        int hash = 0;
>        hash += (examId != null ? examId.hashCode() : 0);
>        return hash;
>    }
>
>   �...@override
>    public boolean equals(Object object) {
>        // TODO: Warning - this method won't work in the case the id
> fields are not set
>        if (!(object instanceof Exam)) {
>            return false;
>        }
>        Exam other = (Exam) object;
>        if ((this.examId == null && other.examId != null) ||
> (this.examId != null && !this.examId.equals(other.examId))) {
>            return false;
>        }
>        return true;
>    }
>
>   �...@override
>    public String toString() {
>        return "entity.Exam[examId=" + examId + "]";
>    }
>
> }
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to