PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 82 lines | 49 code | 15 blank | 18 comment | 10 complexity | 6d63dffa756fcad5c2d24b644b87805f 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 BidirectionalChildStringPkListJPA {
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 HasOneToManyStringPkListJPA parent;
39
40  private String childVal;
41
42  public HasOneToManyStringPkListJPA getParent() {
43    return parent;
44  }
45
46  public void setParent(HasOneToManyStringPkListJPA parent) {
47    this.parent = 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    BidirectionalChildStringPkListJPA that = (BidirectionalChildStringPkListJPA) 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}