PageRenderTime 14ms CodeModel.GetById 1ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 71 lines | 41 code | 12 blank | 18 comment | 0 complexity | 93bdc93df076aed53d6144c7e8db40dc 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.FetchType;
26import javax.persistence.GeneratedValue;
27import javax.persistence.GenerationType;
28import javax.persistence.Id;
29import javax.persistence.ManyToOne;
30import javax.persistence.OneToMany;
31
32/**
33 * @author Max Ross <maxr@google.com>
34 */
35@Entity
36public class HasLongPkOneToManyBidirChildrenJPA {
37  @Id
38  @GeneratedValue(strategy=GenerationType.IDENTITY)
39  private Long id;
40
41  public Long getId() {
42    return id;
43  }
44
45  @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL)
46  private List<ChildA> childAList = new ArrayList<ChildA>();
47
48  public List<ChildA> getChildAList() {
49    return childAList;
50  }
51
52  public void setChildAList(List<ChildA> childAList) {
53    this.childAList = childAList;
54  }
55
56  @Entity
57  public static class ChildA {
58
59    @SuppressWarnings("unused")
60    @Id
61    @GeneratedValue(strategy=GenerationType.IDENTITY)
62    private Key key;
63
64    @ManyToOne(fetch = FetchType.LAZY)
65    private HasLongPkOneToManyBidirChildrenJPA parent;
66
67    public HasLongPkOneToManyBidirChildrenJPA getParent() {
68      return parent;
69    }
70  }
71}