PageRenderTime 53ms CodeModel.GetById 44ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 79 lines | 50 code | 11 blank | 18 comment | 0 complexity | 6e9f9357b9d045b91fa3b532ceaa2e0e 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.persistence.CascadeType;
21import javax.persistence.Entity;
22import javax.persistence.FetchType;
23import javax.persistence.GeneratedValue;
24import javax.persistence.GenerationType;
25import javax.persistence.Id;
26import javax.persistence.OneToMany;
27import javax.persistence.OneToOne;
28import javax.persistence.SequenceGenerator;
29import javax.persistence.Table;
30import javax.persistence.UniqueConstraint;
31
32/**
33 * @author Max Ross <maxr@google.com>
34 */
35public class IgnorableMappingsJPA {
36
37  @Entity
38  public static class OneToManyParentWithEagerlyFetchedChildList {
39    @Id
40    @GeneratedValue(strategy=GenerationType.IDENTITY)
41    public Long id;
42
43    @SuppressWarnings("unused")
44    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
45    private List<HasKeyPkJPA> children;
46  }
47
48  @Entity
49  public static class OneToManyParentWithEagerlyFetchedChild {
50    @Id
51    @GeneratedValue(strategy=GenerationType.IDENTITY)
52    public Long id;
53
54    @SuppressWarnings("unused")
55    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
56    private HasKeyPkJPA child;
57  }
58
59  @Entity
60  @Table(uniqueConstraints = @UniqueConstraint(columnNames = "f1"))
61  public static class HasUniqueConstraint {
62    @Id
63    @GeneratedValue(strategy=GenerationType.IDENTITY)
64    public Long id;
65
66    @SuppressWarnings("unused")
67    private String f1;
68  }
69
70  @Entity
71  public static class HasInitialSequenceValue {
72    @SuppressWarnings("unused")
73    @Id
74    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "yar")
75    @SequenceGenerator(name = "yar", initialValue = 5)
76    private Long id;
77  }
78
79}