PageRenderTime 35ms CodeModel.GetById 24ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://datanucleus-appengine.googlecode.com/
Java | 89 lines | 53 code | 18 blank | 18 comment | 0 complexity | 373ec76bde5d60ed5b3ee84aa509e3e2 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.ArrayList;
19import java.util.List;
20
21import javax.persistence.CascadeType;
22import javax.persistence.Entity;
23import javax.persistence.GeneratedValue;
24import javax.persistence.GenerationType;
25import javax.persistence.Id;
26import javax.persistence.OneToMany;
27import javax.persistence.OrderBy;
28
29/**
30 * @author Max Ross <maxr@google.com>
31 */
32@Entity
33public class HasOneToManyWithOrderByJPA {
34
35  @Id
36  @GeneratedValue(strategy=GenerationType.IDENTITY)
37  private Long id;
38
39  private String val;
40
41  @OneToMany(cascade = CascadeType.ALL)
42  @OrderBy("author DESC, title ASC")
43  private List<Book> booksByAuthorAndTitle = new ArrayList<Book>();
44
45  @OneToMany(cascade = CascadeType.ALL)
46  @OrderBy("id DESC, author ASC")
47  private List<Book> booksByIdAndAuthor = new ArrayList<Book>();
48
49  @OneToMany(cascade = CascadeType.ALL)
50  @OrderBy("author DESC, id ASC")
51  private List<Book> booksByAuthorAndId = new ArrayList<Book>();
52
53  public Long getId() {
54    return id;
55  }
56
57  public List<Book> getBooksByAuthorAndTitle() {
58    return booksByAuthorAndTitle;
59  }
60
61  public void setBooksByAuthorAndTitle(List<Book> booksByAuthorAndTitle) {
62    this.booksByAuthorAndTitle = booksByAuthorAndTitle;
63  }
64
65  public List<Book> getBooksByIdAndAuthor() {
66    return booksByIdAndAuthor;
67  }
68
69  public void setBooksByIdAndAuthor(List<Book> booksByIdAndAuthor) {
70    this.booksByIdAndAuthor = booksByIdAndAuthor;
71  }
72
73  public List<Book> getBooksByAuthorAndId() {
74    return booksByAuthorAndId;
75  }
76
77  public void setBooksByAuthorAndId(List<Book> booksByAuthorAndId) {
78    this.booksByAuthorAndId = booksByAuthorAndId;
79  }
80
81  public String getVal() {
82    return val;
83  }
84
85  public void setVal(String val) {
86    this.val = val;
87  }
88
89}