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

http://datanucleus-appengine.googlecode.com/ · Java · 65 lines · 36 code · 11 blank · 18 comment · 0 complexity · 0c2716a2aef9ce13e9d4c5567273265e 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 org.datanucleus.api.jpa.annotations.Extension;
  15. import javax.persistence.Entity;
  16. import javax.persistence.FetchType;
  17. import javax.persistence.GeneratedValue;
  18. import javax.persistence.GenerationType;
  19. import javax.persistence.Id;
  20. import javax.persistence.OneToOne;
  21. /**
  22. * @author Max Ross <maxr@google.com>
  23. */
  24. @Entity
  25. public class HasOneToOneParentJPA {
  26. @Id
  27. @GeneratedValue(strategy=GenerationType.IDENTITY)
  28. @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
  29. private String id;
  30. @OneToOne(mappedBy = "hasParent", fetch = FetchType.LAZY)
  31. private HasOneToOneJPA parent;
  32. private String str;
  33. public String getId() {
  34. return id;
  35. }
  36. public HasOneToOneJPA getParent() {
  37. return parent;
  38. }
  39. public void setParent(HasOneToOneJPA parent) {
  40. this.parent = parent;
  41. }
  42. public String getStr() {
  43. return str;
  44. }
  45. public void setStr(String str) {
  46. this.str = str;
  47. }
  48. public void setId(String id) {
  49. this.id = id;
  50. }
  51. }