PageRenderTime 34ms CodeModel.GetById 26ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 73 lines | 43 code | 15 blank | 15 comment | 0 complexity | 45db31a87e84f789128886a326d08273 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.HashSet;
19import java.util.Set;
20
21import javax.jdo.annotations.Extension;
22import javax.jdo.annotations.IdGeneratorStrategy;
23import javax.jdo.annotations.PersistenceCapable;
24import javax.jdo.annotations.Persistent;
25import javax.jdo.annotations.PrimaryKey;
26
27public class HasRecursiveParentJDO {
28
29  public HasRecursiveParentJDO() {
30  }
31
32  @PersistenceCapable
33  public static class HasRecursiveParent {
34    @PrimaryKey
35    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
36    @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
37    private String id;
38
39    @Persistent
40    private String name;
41
42    @Persistent
43    private HasRecursiveParent parent;
44
45    @Persistent(mappedBy = "parent")
46    private Set<HasRecursiveParent> children = new HashSet<HasRecursiveParent>();
47
48    public String getId() {
49      return id;
50    }
51
52    public String getName() {
53      return name;
54    }
55
56    public void setName(String name) {
57      this.name = name;
58    }
59
60    public HasRecursiveParent getParent() {
61      return parent;
62    }
63
64    public void setParent(HasRecursiveParent parent) {
65      this.parent = parent;
66    }
67
68    public Set<HasRecursiveParent> getChildren() {
69      return children;
70    }
71  }
72  
73}