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

http://datanucleus-appengine.googlecode.com/ · Java · 72 lines · 41 code · 13 blank · 18 comment · 0 complexity · 2eb00de86080ae21e18600b148744976 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 com.google.appengine.api.datastore.Key;
  15. import java.util.ArrayList;
  16. import java.util.List;
  17. import javax.jdo.annotations.Element;
  18. import javax.jdo.annotations.IdGeneratorStrategy;
  19. import javax.jdo.annotations.PersistenceCapable;
  20. import javax.jdo.annotations.Persistent;
  21. import javax.jdo.annotations.PrimaryKey;
  22. /**
  23. * @author Max Ross <maxr@google.com>
  24. */
  25. @PersistenceCapable(detachable = "true")
  26. public class HasUnencodedStringPkOneToManyBidirChildrenJDO {
  27. @PrimaryKey
  28. private String id;
  29. public String getId() {
  30. return id;
  31. }
  32. public void setId(String id) {
  33. this.id = id;
  34. }
  35. @Persistent(mappedBy = "parent")
  36. @Element(dependent = "true")
  37. private List<ChildA> childAList = new ArrayList<ChildA>();
  38. public List<ChildA> getChildAList() {
  39. return childAList;
  40. }
  41. public void setChildAList(List<ChildA> childAList) {
  42. this.childAList = childAList;
  43. }
  44. @PersistenceCapable(detachable = "true")
  45. public static class ChildA {
  46. @SuppressWarnings("unused")
  47. @PrimaryKey
  48. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  49. private Key key;
  50. @Persistent
  51. private HasUnencodedStringPkOneToManyBidirChildrenJDO parent;
  52. public HasUnencodedStringPkOneToManyBidirChildrenJDO getParent() {
  53. return parent;
  54. }
  55. }
  56. }