PageRenderTime 109ms CodeModel.GetById 101ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 55 lines | 27 code | 10 blank | 18 comment | 0 complexity | 0729bcdabf0fc1d586f12797240a532e 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.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 HasOneToManyKeyPkListJPA implements HasOneToManyKeyPkJPA {
35
36  @Id
37  @GeneratedValue(strategy=GenerationType.IDENTITY)
38  private Key id;
39
40  @OneToMany(cascade = CascadeType.ALL)
41  private List<Book> books = new ArrayList<Book>();
42
43  public Key getId() {
44    return id;
45  }
46
47  public List<Book> getBooks() {
48    return books;
49  }
50
51  public void nullBooks() {
52    this.books = null;
53  }
54
55}