PageRenderTime 82ms CodeModel.GetById 74ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 87 lines | 51 code | 18 blank | 18 comment | 0 complexity | 8e08c4058cd6c9f9752de1b686202a36 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.HashSet;
21import java.util.Set;
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 HasOneToManySetJPA 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 Set<BidirectionalChildSetJPA> bidirChildren = new HashSet<BidirectionalChildSetJPA>();
45
46  @OneToMany(cascade = CascadeType.ALL)
47  private Set<Book> books = new HashSet<Book>();
48
49  @OneToMany(cascade = CascadeType.ALL)
50  private Set<HasKeyPkJPA> hasKeyPks = new HashSet<HasKeyPkJPA>();
51
52  public String getId() {
53    return id;
54  }
55
56  public Set<BidirectionalChildJPA> getBidirChildren() {
57    return (Set) bidirChildren;
58  }
59
60  public void nullBidirChildren() {
61    this.bidirChildren = null;
62  }
63
64  public Set<Book> getBooks() {
65    return books;
66  }
67
68  public void nullBooks() {
69    this.books = null;
70  }
71
72  public Set<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}