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

http://datanucleus-appengine.googlecode.com/ · Java · 82 lines · 49 code · 15 blank · 18 comment · 10 complexity · 657ed3a7aba65682cb8886770838c012 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 BidirectionalGrandchildListJPA {
  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 BidirectionalChildListJPA parent;
  32. private String childVal;
  33. public BidirectionalChildListJPA getParent() {
  34. return parent;
  35. }
  36. public void setParent(BidirectionalChildListJPA parent) {
  37. this.parent = 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. BidirectionalGrandchildListJPA that = (BidirectionalGrandchildListJPA) 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. }