• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 Google, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.inject.persist.jpa;
18 
19 import javax.persistence.Entity;
20 import javax.persistence.GeneratedValue;
21 import javax.persistence.Id;
22 
23 /** @author Dhanji R. Prasanna (dhanji@gmail.com) */
24 @Entity
25 public class JpaTestEntity {
26   private Long id;
27   private String text;
28 
29   @Id
30   @GeneratedValue
getId()31   public Long getId() {
32     return id;
33   }
34 
setId(Long id)35   public void setId(Long id) {
36     this.id = id;
37   }
38 
getText()39   public String getText() {
40     return text;
41   }
42 
setText(String text)43   public void setText(String text) {
44     this.text = text;
45   }
46 
47   @Override
equals(Object o)48   public boolean equals(Object o) {
49     if (this == o) {
50       return true;
51     }
52     if (o == null || getClass() != o.getClass()) {
53       return false;
54     }
55 
56     JpaTestEntity that = (JpaTestEntity) o;
57 
58     if (id != null ? !id.equals(that.id) : that.id != null) {
59       return false;
60     }
61     if (text != null ? !text.equals(that.text) : that.text != null) {
62       return false;
63     }
64 
65     return true;
66   }
67 
68   @Override
hashCode()69   public int hashCode() {
70     int result = id != null ? id.hashCode() : 0;
71     result = 31 * result + (text != null ? text.hashCode() : 0);
72     return result;
73   }
74 }
75