PageRenderTime 16ms CodeModel.GetById 8ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 61 lines | 33 code | 10 blank | 18 comment | 0 complexity | 698e1f7d5772e03a1eca2a7e06a4352d 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 java.util.Collection;
19import java.util.HashSet;
20import java.util.Set;
21
22import javax.persistence.CascadeType;
23import javax.persistence.Entity;
24import javax.persistence.GeneratedValue;
25import javax.persistence.GenerationType;
26import javax.persistence.Id;
27import javax.persistence.OneToMany;
28
29/**
30 * @author Max Ross <maxr@google.com>
31 */
32@Entity
33public class HasOneToManyLongPkSetJPA implements HasOneToManyLongPkJPA {
34
35  @Id
36  @GeneratedValue(strategy=GenerationType.IDENTITY)
37  private Long id;
38
39  @OneToMany(cascade = CascadeType.ALL)
40  private Set<Book> books = new HashSet<Book>();
41
42  @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL)
43  private Set<BidirectionalChildLongPkSetJPA> bidirChildren =
44      new HashSet<BidirectionalChildLongPkSetJPA>();
45
46  public Long getId() {
47    return id;
48  }
49
50  public Set<Book> getBooks() {
51    return books;
52  }
53
54  public void nullBooks() {
55    this.books = null;
56  }
57
58  public Collection<BidirectionalChildLongPkJPA> getBidirChildren() {
59    return (Set) bidirChildren;
60  }
61}