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

http://datanucleus-appengine.googlecode.com/ · Java · 76 lines · 44 code · 14 blank · 18 comment · 0 complexity · 7cb775abfec171671ba59feaecec28f6 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.ArrayList;
  15. import java.util.List;
  16. import javax.jdo.annotations.Element;
  17. import javax.jdo.annotations.Extension;
  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 BidirectionalChildListJDO implements BidirectionalChildJDO {
  27. @PrimaryKey
  28. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  29. @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value="true")
  30. private String id;
  31. @Persistent
  32. private HasOneToManyListJDO parent;
  33. @Persistent(mappedBy = "parent")
  34. @Element(dependent = "true")
  35. private List<BidirectionalGrandchildListJDO> bidirGrandChildren =
  36. new ArrayList<BidirectionalGrandchildListJDO>();
  37. private String childVal;
  38. public String getId() {
  39. return id;
  40. }
  41. public HasOneToManyListJDO getParent() {
  42. return parent;
  43. }
  44. public void setParent(HasOneToManyJDO parent) {
  45. this.parent = (HasOneToManyListJDO) parent;
  46. }
  47. public String getChildVal() {
  48. return childVal;
  49. }
  50. public void setChildVal(String childVal) {
  51. this.childVal = childVal;
  52. }
  53. public List<BidirectionalGrandchildListJDO> getBidirGrandChildren() {
  54. return bidirGrandChildren;
  55. }
  56. public void setBidirGrandChildren(List<BidirectionalGrandchildListJDO> bidirGrandChildren) {
  57. this.bidirGrandChildren = bidirGrandChildren;
  58. }
  59. }