PageRenderTime 16ms CodeModel.GetById 10ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 72 lines | 41 code | 13 blank | 18 comment | 0 complexity | 2eb00de86080ae21e18600b148744976 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 HasUnencodedStringPkOneToManyBidirChildrenJDO {
34  @PrimaryKey
35  private String id;
36
37  public String getId() {
38    return id;
39  }
40
41  public void setId(String id) {
42    this.id = id;
43  }
44
45  @Persistent(mappedBy = "parent")
46  @Element(dependent = "true")
47  private List<ChildA> childAList = new ArrayList<ChildA>();
48
49  public List<ChildA> getChildAList() {
50    return childAList;
51  }
52
53  public void setChildAList(List<ChildA> childAList) {
54    this.childAList = childAList;
55  }
56
57  @PersistenceCapable(detachable = "true")
58  public static class ChildA {
59
60    @SuppressWarnings("unused")
61    @PrimaryKey
62    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
63    private Key key;
64
65    @Persistent
66    private HasUnencodedStringPkOneToManyBidirChildrenJDO parent;
67
68    public HasUnencodedStringPkOneToManyBidirChildrenJDO getParent() {
69      return parent;
70    }
71  }
72}