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

http://datanucleus-appengine.googlecode.com/ · Java · 86 lines · 50 code · 18 blank · 18 comment · 0 complexity · 89e727e73b3b90bd1d17c052ff7f6f15 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.persistence.CascadeType;
  17. import javax.persistence.Entity;
  18. import javax.persistence.Id;
  19. import javax.persistence.OneToMany;
  20. /**
  21. * @author Max Ross <maxr@google.com>
  22. */
  23. @Entity
  24. public class HasOneToManyStringPkListJPA {
  25. @Id
  26. private String id;
  27. private String val;
  28. @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL)
  29. private List<BidirectionalChildStringPkListJPA> bidirChildren =
  30. new ArrayList<BidirectionalChildStringPkListJPA>();
  31. @OneToMany(cascade = CascadeType.ALL)
  32. private List<Book> books = new ArrayList<Book>();
  33. @OneToMany(cascade = CascadeType.ALL)
  34. private List<HasKeyPkJPA> hasKeyPks = new ArrayList<HasKeyPkJPA>();
  35. public String getId() {
  36. return id;
  37. }
  38. public void setId(String id) {
  39. this.id = id;
  40. }
  41. public List<BidirectionalChildStringPkListJPA> getBidirChildren() {
  42. return (List) bidirChildren;
  43. }
  44. public void nullBidirChildren() {
  45. this.bidirChildren = null;
  46. }
  47. public List<Book> getBooks() {
  48. return books;
  49. }
  50. public void nullBooks() {
  51. this.books = null;
  52. }
  53. public List<HasKeyPkJPA> getHasKeyPks() {
  54. return hasKeyPks;
  55. }
  56. public void nullHasKeyPks() {
  57. this.hasKeyPks = null;
  58. }
  59. public String getVal() {
  60. return val;
  61. }
  62. public void setVal(String val) {
  63. this.val = val;
  64. }
  65. }