PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 62 lines | 33 code | 11 blank | 18 comment | 0 complexity | da5124dcb6c10c095fb308c6a7ccff3f MD5 | raw file
 1/**********************************************************************
 2Copyright (c) 2011 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.IdGeneratorStrategy;
22import javax.jdo.annotations.PersistenceCapable;
23import javax.jdo.annotations.Persistent;
24import javax.jdo.annotations.PrimaryKey;
25
26import com.google.appengine.datanucleus.annotations.Unowned;
27
28/**
29 * "Owner" of a 1-N unidirectional relation in JDO, using unowned relations.
30 */
31@PersistenceCapable(detachable="true")
32public class UnownedJDOOneToManyUniSideA {
33  @PrimaryKey
34  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
35  Long id;
36
37  @Persistent
38  @Unowned
39  Set<UnownedJDOOneToManyUniSideB> others = new HashSet<UnownedJDOOneToManyUniSideB>();
40
41  String name;
42
43  public Long getId() {
44    return id;
45  }
46
47  public void setName(String name) {
48    this.name = name;
49  }
50
51  public String getName() {
52    return name;
53  }
54
55  public void addOther(UnownedJDOOneToManyUniSideB other) {
56    this.others.add(other);
57  }
58
59  public Set<UnownedJDOOneToManyUniSideB> getOthers() {
60    return others;
61  }
62}