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

http://datanucleus-appengine.googlecode.com/ · Java · 73 lines · 43 code · 15 blank · 15 comment · 0 complexity · 45db31a87e84f789128886a326d08273 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 java.util.HashSet;
  15. import java.util.Set;
  16. import javax.jdo.annotations.Extension;
  17. import javax.jdo.annotations.IdGeneratorStrategy;
  18. import javax.jdo.annotations.PersistenceCapable;
  19. import javax.jdo.annotations.Persistent;
  20. import javax.jdo.annotations.PrimaryKey;
  21. public class HasRecursiveParentJDO {
  22. public HasRecursiveParentJDO() {
  23. }
  24. @PersistenceCapable
  25. public static class HasRecursiveParent {
  26. @PrimaryKey
  27. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  28. @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
  29. private String id;
  30. @Persistent
  31. private String name;
  32. @Persistent
  33. private HasRecursiveParent parent;
  34. @Persistent(mappedBy = "parent")
  35. private Set<HasRecursiveParent> children = new HashSet<HasRecursiveParent>();
  36. public String getId() {
  37. return id;
  38. }
  39. public String getName() {
  40. return name;
  41. }
  42. public void setName(String name) {
  43. this.name = name;
  44. }
  45. public HasRecursiveParent getParent() {
  46. return parent;
  47. }
  48. public void setParent(HasRecursiveParent parent) {
  49. this.parent = parent;
  50. }
  51. public Set<HasRecursiveParent> getChildren() {
  52. return children;
  53. }
  54. }
  55. }