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

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

http://datanucleus-appengine.googlecode.com/
Java | 105 lines | 66 code | 21 blank | 18 comment | 0 complexity | 2c8c11140a60889d91f48856e0f22bff 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;
 19import com.google.appengine.datanucleus.Utils;
 20
 21
 22import java.util.List;
 23
 24import javax.jdo.annotations.Element;
 25import javax.jdo.annotations.IdGeneratorStrategy;
 26import javax.jdo.annotations.PersistenceCapable;
 27import javax.jdo.annotations.Persistent;
 28import javax.jdo.annotations.PrimaryKey;
 29
 30/**
 31 * @author Max Ross <maxr@google.com>
 32 */
 33@PersistenceCapable(detachable = "true")
 34public class HasMultipleBidirChildrenJDO {
 35
 36  @PrimaryKey
 37  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 38  private Long id;
 39
 40  @Persistent(mappedBy = "parent")
 41  @Element(dependent = "true")
 42  private List<BidirChild1> child1 = Utils.newArrayList();
 43
 44  @Persistent(mappedBy = "parent")
 45  @Element(dependent = "true")
 46  private List<BidirChild2> child2 = Utils.newArrayList();
 47
 48  public Long getId() {
 49    return id;
 50  }
 51
 52  public List<BidirChild1> getChild1() {
 53    return child1;
 54  }
 55
 56  public void setChild1(List<BidirChild1> child1) {
 57    this.child1 = child1;
 58  }
 59
 60  public List<BidirChild2> getChild2() {
 61    return child2;
 62  }
 63
 64  public void setChild2(List<BidirChild2> child2) {
 65    this.child2 = child2;
 66  }
 67
 68  @PersistenceCapable(detachable = "true")
 69  public static class BidirChild1 {
 70    @PrimaryKey
 71    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 72    private Key id;
 73
 74    @SuppressWarnings("unused")
 75    @Persistent
 76    private HasMultipleBidirChildrenJDO parent;
 77
 78    public Key getId() {
 79      return id;
 80    }
 81
 82    public void setId(Key id) {
 83      this.id = id;
 84    }
 85  }
 86
 87  @PersistenceCapable(detachable = "true")
 88  public static class BidirChild2 {
 89    @PrimaryKey
 90    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
 91    private Key id;
 92
 93    @SuppressWarnings("unused")
 94    @Persistent
 95    private HasMultipleBidirChildrenJDO parent;
 96
 97    public Key getId() {
 98      return id;
 99    }
100
101    public void setId(Key id) {
102      this.id = id;
103    }
104  }
105}