PageRenderTime 29ms CodeModel.GetById 24ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 69 lines | 39 code | 12 blank | 18 comment | 0 complexity | 5c26f1b27f21de63a39662ea1b88ba3c 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.jdo.annotations.Element;
24import javax.jdo.annotations.IdGeneratorStrategy;
25import javax.jdo.annotations.PersistenceCapable;
26import javax.jdo.annotations.Persistent;
27import javax.jdo.annotations.PrimaryKey;
28
29/**
30 * @author Max Ross <maxr@google.com>
31 */
32@PersistenceCapable(detachable = "true")
33public class HasLongPkOneToManyBidirChildrenJDO {
34  @PrimaryKey
35  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
36  private Long id;
37
38  public Long getId() {
39    return id;
40  }
41
42  @Persistent(mappedBy = "parent")
43  @Element(dependent = "true")
44  private List<ChildA> childAList = new ArrayList<ChildA>();
45
46  public List<ChildA> getChildAList() {
47    return childAList;
48  }
49
50  public void setChildAList(List<ChildA> childAList) {
51    this.childAList = childAList;
52  }
53
54  @PersistenceCapable(detachable = "true")
55  public static class ChildA {
56
57    @SuppressWarnings("unused")
58    @PrimaryKey
59    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
60    private Key key;
61
62    @Persistent
63    private HasLongPkOneToManyBidirChildrenJDO parent;
64
65    public HasLongPkOneToManyBidirChildrenJDO getParent() {
66      return parent;
67    }
68  }
69}