PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 87 lines | 51 code | 18 blank | 18 comment | 0 complexity | 9c0c0b4c4cbcc61468a70a090a311653 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 org.datanucleus.api.jpa.annotations.Extension;
19
20import java.util.ArrayList;
21import java.util.List;
22
23import javax.persistence.CascadeType;
24import javax.persistence.Entity;
25import javax.persistence.GeneratedValue;
26import javax.persistence.GenerationType;
27import javax.persistence.Id;
28import javax.persistence.OneToMany;
29
30/**
31 * @author Max Ross <maxr@google.com>
32 */
33@Entity
34public class HasOneToManyListJPA implements HasOneToManyJPA {
35
36  @Id
37  @GeneratedValue(strategy=GenerationType.IDENTITY)
38  @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
39  private String id;
40
41  private String val;
42
43  @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL)
44  private List<BidirectionalChildListJPA> bidirChildren = new ArrayList<BidirectionalChildListJPA>();
45
46  @OneToMany(cascade = CascadeType.ALL)
47  private List<Book> books = new ArrayList<Book>();
48
49  @OneToMany(cascade = CascadeType.ALL)
50  private List<HasKeyPkJPA> hasKeyPks = new ArrayList<HasKeyPkJPA>();
51
52  public String getId() {
53    return id;
54  }
55
56  public List<BidirectionalChildJPA> getBidirChildren() {
57    return (List) bidirChildren;
58  }
59
60  public void nullBidirChildren() {
61    this.bidirChildren = null;
62  }
63
64  public List<Book> getBooks() {
65    return books;
66  }
67
68  public void nullBooks() {
69    this.books = null;
70  }
71
72  public List<HasKeyPkJPA> getHasKeyPks() {
73    return hasKeyPks;
74  }
75
76  public void nullHasKeyPks() {
77    this.hasKeyPks = null;
78  }
79
80  public String getVal() {
81    return val;
82  }
83
84  public void setVal(String val) {
85    this.val = val;
86  }
87}