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

http://datanucleus-appengine.googlecode.com/ · Java · 70 lines · 37 code · 14 blank · 19 comment · 0 complexity · 16b74dbbf61ff41e0728758e54b084cb MD5 · raw file

  1. /*
  2. * /**********************************************************************
  3. * Copyright (c) 2009 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. * **********************************************************************/
  17. package com.google.appengine.datanucleus.test;
  18. import com.google.appengine.api.datastore.Key;
  19. import com.google.appengine.datanucleus.Utils;
  20. import java.util.List;
  21. import javax.jdo.annotations.Element;
  22. import javax.jdo.annotations.Extension;
  23. import javax.jdo.annotations.IdGeneratorStrategy;
  24. import javax.jdo.annotations.Order;
  25. import javax.jdo.annotations.PersistenceCapable;
  26. import javax.jdo.annotations.Persistent;
  27. import javax.jdo.annotations.PrimaryKey;
  28. /**
  29. * @author Max Ross <maxr@google.com>
  30. */
  31. @PersistenceCapable(detachable = "true")
  32. public class HasOneToManyChildAtMultipleLevelsJDO {
  33. @PrimaryKey
  34. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  35. private Key id;
  36. @Element(dependent = "true")
  37. @Order(extensions = @Extension(vendorName = "datanucleus", key="list-ordering", value="id"))
  38. private List<Flight> flights = Utils.newArrayList();
  39. @Persistent(dependent = "true")
  40. private HasOneToManyChildAtMultipleLevelsJDO child;
  41. public Key getId() {
  42. return id;
  43. }
  44. public List<Flight> getFlights() {
  45. return flights;
  46. }
  47. public void setFlights(List<Flight> flights) {
  48. this.flights = flights;
  49. }
  50. public HasOneToManyChildAtMultipleLevelsJDO getChild() {
  51. return child;
  52. }
  53. public void setChild(HasOneToManyChildAtMultipleLevelsJDO child) {
  54. this.child = child;
  55. }
  56. }