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

http://datanucleus-appengine.googlecode.com/ · Java · 82 lines · 49 code · 15 blank · 18 comment · 10 complexity · ed3e8c15056699d1b6662683effbdf5e MD5 · raw file

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