PageRenderTime 13ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 68 lines | 38 code | 12 blank | 18 comment | 0 complexity | ee4cfc4f528b342d6ca1a8436f9319b3 MD5 | raw file
Possible License(s): Apache-2.0
  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 com.google.appengine.api.datastore.Key;
  15. import java.util.List;
  16. import javax.persistence.CascadeType;
  17. import javax.persistence.Entity;
  18. import javax.persistence.FetchType;
  19. import javax.persistence.GeneratedValue;
  20. import javax.persistence.GenerationType;
  21. import javax.persistence.Id;
  22. import javax.persistence.JoinColumn;
  23. import javax.persistence.OneToMany;
  24. import javax.persistence.OneToOne;
  25. /**
  26. * @author Max Ross <maxr@google.com>
  27. */
  28. @Entity
  29. public class HasOneToManyChildAtMultipleLevelsJPA {
  30. @Id
  31. @GeneratedValue(strategy= GenerationType.IDENTITY)
  32. private Key id;
  33. @OneToMany(cascade = CascadeType.ALL)
  34. private List<Book> books;
  35. @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  36. @JoinColumn(name = "child_id")
  37. private HasOneToManyChildAtMultipleLevelsJPA child;
  38. public Key getId() {
  39. return id;
  40. }
  41. public List<Book> getBooks() {
  42. return books;
  43. }
  44. public void setBooks(List<Book> books) {
  45. this.books = books;
  46. }
  47. public HasOneToManyChildAtMultipleLevelsJPA getChild() {
  48. return child;
  49. }
  50. public void setChild(HasOneToManyChildAtMultipleLevelsJPA child) {
  51. this.child = child;
  52. }
  53. }