PageRenderTime 52ms CodeModel.GetById 33ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 92 lines | 60 code | 13 blank | 19 comment | 0 complexity | 837c885ccbf785b4b3a20432b4a885b6 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.List;
19
20import javax.jdo.annotations.Element;
21import javax.jdo.annotations.Embedded;
22import javax.jdo.annotations.IdGeneratorStrategy;
23import javax.jdo.annotations.IdentityType;
24import javax.jdo.annotations.PersistenceCapable;
25import javax.jdo.annotations.Persistent;
26import javax.jdo.annotations.PrimaryKey;
27import javax.jdo.annotations.Unique;
28import javax.jdo.annotations.Uniques;
29
30/**
31 * @author Max Ross <maxr@google.com>
32 */
33public class IgnorableMappingsJDO {
34
35  @PersistenceCapable(identityType = IdentityType.APPLICATION)
36  public static class OneToManyParentWithEagerlyFetchedChildList {
37    @PrimaryKey
38    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
39    public Long id;
40
41    @SuppressWarnings("unused")
42    @Persistent(defaultFetchGroup = "true")
43    @Element(dependent = "true")
44    private List<HasKeyPkJDO> children;
45  }
46
47  @PersistenceCapable(identityType = IdentityType.APPLICATION)
48  public static class OneToManyParentWithEagerlyFetchedChild {
49    @PrimaryKey
50    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
51    public Long id;
52
53    @SuppressWarnings("unused")
54    @Persistent(dependent = "true", defaultFetchGroup = "true")
55    private HasKeyPkJDO child;
56  }
57
58  @PersistenceCapable(identityType = IdentityType.APPLICATION)
59  public static class OneToManyParentWithEagerlyFetchedEmbeddedChild {
60    @PrimaryKey
61    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
62    public Long id;
63
64    // this is actually ok because it's embedded
65    @SuppressWarnings("unused")
66    @Persistent(dependent = "true", defaultFetchGroup = "true")
67    @Embedded
68    private HasKeyPkJDO child;
69  }
70
71  @PersistenceCapable(identityType = IdentityType.APPLICATION)
72  @Unique(name = "blar", members = {"f1"})
73  public static class HasUniqueConstraint {
74    @PrimaryKey
75    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
76    public Long id;
77
78    @Persistent
79    public String f1;
80  }
81
82  @PersistenceCapable(identityType = IdentityType.APPLICATION)
83  @Uniques({@Unique(name = "blar", members = {"f1"})})
84  public static class HasUniqueConstraints {
85    @PrimaryKey
86    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
87    public Long id;
88
89    @Persistent
90    public String f1;
91  }
92}