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

http://datanucleus-appengine.googlecode.com/ · Java · 92 lines · 60 code · 13 blank · 19 comment · 0 complexity · 837c885ccbf785b4b3a20432b4a885b6 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.List;
  15. import javax.jdo.annotations.Element;
  16. import javax.jdo.annotations.Embedded;
  17. import javax.jdo.annotations.IdGeneratorStrategy;
  18. import javax.jdo.annotations.IdentityType;
  19. import javax.jdo.annotations.PersistenceCapable;
  20. import javax.jdo.annotations.Persistent;
  21. import javax.jdo.annotations.PrimaryKey;
  22. import javax.jdo.annotations.Unique;
  23. import javax.jdo.annotations.Uniques;
  24. /**
  25. * @author Max Ross <maxr@google.com>
  26. */
  27. public class IgnorableMappingsJDO {
  28. @PersistenceCapable(identityType = IdentityType.APPLICATION)
  29. public static class OneToManyParentWithEagerlyFetchedChildList {
  30. @PrimaryKey
  31. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  32. public Long id;
  33. @SuppressWarnings("unused")
  34. @Persistent(defaultFetchGroup = "true")
  35. @Element(dependent = "true")
  36. private List<HasKeyPkJDO> children;
  37. }
  38. @PersistenceCapable(identityType = IdentityType.APPLICATION)
  39. public static class OneToManyParentWithEagerlyFetchedChild {
  40. @PrimaryKey
  41. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  42. public Long id;
  43. @SuppressWarnings("unused")
  44. @Persistent(dependent = "true", defaultFetchGroup = "true")
  45. private HasKeyPkJDO child;
  46. }
  47. @PersistenceCapable(identityType = IdentityType.APPLICATION)
  48. public static class OneToManyParentWithEagerlyFetchedEmbeddedChild {
  49. @PrimaryKey
  50. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  51. public Long id;
  52. // this is actually ok because it's embedded
  53. @SuppressWarnings("unused")
  54. @Persistent(dependent = "true", defaultFetchGroup = "true")
  55. @Embedded
  56. private HasKeyPkJDO child;
  57. }
  58. @PersistenceCapable(identityType = IdentityType.APPLICATION)
  59. @Unique(name = "blar", members = {"f1"})
  60. public static class HasUniqueConstraint {
  61. @PrimaryKey
  62. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  63. public Long id;
  64. @Persistent
  65. public String f1;
  66. }
  67. @PersistenceCapable(identityType = IdentityType.APPLICATION)
  68. @Uniques({@Unique(name = "blar", members = {"f1"})})
  69. public static class HasUniqueConstraints {
  70. @PrimaryKey
  71. @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  72. public Long id;
  73. @Persistent
  74. public String f1;
  75. }
  76. }