PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms 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
 1/**********************************************************************
 2Copyright (c) 2009 Google Inc.
 3
 4Licensed under the Apache License, Version 2.0 (the "License");
 5you may not use this file except in compliance with the License.
 6You may obtain a copy of the License at
 7
 8http://www.apache.org/licenses/LICENSE-2.0
 9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15**********************************************************************/
16package com.google.appengine.datanucleus.test;
17
18import com.google.appengine.api.datastore.Key;
19
20import java.util.List;
21
22import javax.persistence.CascadeType;
23import javax.persistence.Entity;
24import javax.persistence.FetchType;
25import javax.persistence.GeneratedValue;
26import javax.persistence.GenerationType;
27import javax.persistence.Id;
28import javax.persistence.JoinColumn;
29import javax.persistence.OneToMany;
30import javax.persistence.OneToOne;
31
32/**
33 * @author Max Ross <maxr@google.com>
34 */
35@Entity
36public class HasOneToManyChildAtMultipleLevelsJPA {
37
38  @Id
39  @GeneratedValue(strategy= GenerationType.IDENTITY)
40  private Key id;
41
42  @OneToMany(cascade = CascadeType.ALL)
43  private List<Book> books;
44
45  @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
46  @JoinColumn(name = "child_id")
47  private HasOneToManyChildAtMultipleLevelsJPA child;
48
49  public Key getId() {
50    return id;
51  }
52
53  public List<Book> getBooks() {
54    return books;
55  }
56
57  public void setBooks(List<Book> books) {
58    this.books = books;
59  }
60
61  public HasOneToManyChildAtMultipleLevelsJPA getChild() {
62    return child;
63  }
64
65  public void setChild(HasOneToManyChildAtMultipleLevelsJPA child) {
66    this.child = child;
67  }
68}