PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/tests/com/google/appengine/datanucleus/test/BidirectionalChildLongPkSetJPA.java

http://datanucleus-appengine.googlecode.com/
Java | 82 lines | 49 code | 15 blank | 18 comment | 10 complexity | 1b4f39f8d8ad8e6415e194608a1475e9 MD5 | raw file
 1/**********************************************************************
 2Copyright (c) 2009 Google Inc.
 3
 4Licensed under the Apache License, Version 2.0 (the "License");
 5you may not use this file except in compliance with the License.
 6You may obtain a copy of the License at
 7
 8http://www.apache.org/licenses/LICENSE-2.0
 9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15**********************************************************************/
16package com.google.appengine.datanucleus.test;
17
18import org.datanucleus.api.jpa.annotations.Extension;
19
20import javax.persistence.Entity;
21import javax.persistence.FetchType;
22import javax.persistence.GeneratedValue;
23import javax.persistence.GenerationType;
24import javax.persistence.Id;
25import javax.persistence.ManyToOne;
26
27/**
28 * @author Max Ross <maxr@google.com>
29 */
30@Entity
31public class BidirectionalChildLongPkSetJPA implements BidirectionalChildLongPkJPA {
32  @Id
33  @GeneratedValue(strategy=GenerationType.IDENTITY)
34  @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
35  private String id;
36
37  @ManyToOne(fetch = FetchType.LAZY)
38  private HasOneToManyLongPkSetJPA parent;
39
40  private String childVal;
41
42  public HasOneToManyLongPkJPA getParent() {
43    return parent;
44  }
45
46  public void setParent(HasOneToManyLongPkJPA parent) {
47    this.parent = (HasOneToManyLongPkSetJPA) parent;
48  }
49
50  public String getId() {
51    return id;
52  }
53
54  public String getChildVal() {
55    return childVal;
56  }
57
58  public void setChildVal(String childVal) {
59    this.childVal = childVal;
60  }
61
62  public boolean equals(Object o) {
63    if (this == o) {
64      return true;
65    }
66    if (o == null || getClass() != o.getClass()) {
67      return false;
68    }
69
70    BidirectionalChildLongPkSetJPA that = (BidirectionalChildLongPkSetJPA) o;
71
72    if (id != null ? !id.equals(that.id) : that.id != null) {
73      return false;
74    }
75
76    return true;
77  }
78
79  public int hashCode() {
80    return (id != null ? id.hashCode() : 0);
81  }
82}