]> review.fuel-infra Code Review - packages/trusty/mysql-wsrep-5.6.git/blob
1e79d699e1cf22e24696e3fa784626c457080f7f
[packages/trusty/mysql-wsrep-5.6.git] /
1 /*
2    Copyright 2010 Sun Microsystems, Inc.
3    All rights reserved. Use is subject to license terms.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; version 2 of the License.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
17 */
18
19 package com.mysql.clusterj.jpatest.model;
20
21 import java.io.Serializable;
22 import javax.persistence.OneToOne;
23
24 /** Schema
25  *
26 drop table if exists longintstringpk;
27 create table longintstringpk (
28  longpk bigint not null,
29  intpk int not null,
30  stringpk varchar(10) not null,
31  stringvalue varchar(10),
32         CONSTRAINT PK_longintstringpk PRIMARY KEY (longpk, intpk, stringpk)
33
34 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
35
36  */
37 @javax.persistence.Entity
38 @javax.persistence.Table(name="longintstringpk")
39 @javax.persistence.IdClass(value=LongIntStringOid.class)
40 public class LongIntStringPKOneOne extends LongIntStringConstants implements Serializable {
41
42     @javax.persistence.Id
43     @javax.persistence.Column(name="longpk")
44     private Long longpk;
45
46     @javax.persistence.Id
47     @javax.persistence.Column(name="intpk")
48     private int intpk;
49
50     @javax.persistence.Id
51     @javax.persistence.Column(name="stringpk")
52     private String stringpk;
53
54     @javax.persistence.Column(name="stringvalue")
55     private String stringvalue;
56
57     @OneToOne(mappedBy = "longIntStringPKOneOne")
58     private LongIntStringFKOneOne longIntStringFKOneOne;
59
60     public LongIntStringPKOneOne() {
61     }
62
63     public Long getLongpk() {
64         return longpk;
65     }
66
67     public void setLongpk(Long value) {
68         longpk = value;
69     }
70
71     public int getIntpk() {
72         return intpk;
73     }
74
75     public void setIntpk(int value) {
76         intpk = value;
77     }
78
79     public String getStringpk() {
80         return stringpk;
81     }
82
83     public void setStringpk(String value) {
84         stringpk = value;
85     }
86
87     public LongIntStringFKOneOne getLongIntStringFKOneOne() {
88         return longIntStringFKOneOne;
89     }
90
91     public void setLongIntStringFKOneOne(LongIntStringFKOneOne value) {
92         longIntStringFKOneOne = value;
93     }
94
95     static public LongIntStringPKOneOne create(int id) {
96         LongIntStringPKOneOne o = new LongIntStringPKOneOne();
97         o.longpk = getPK1(id);
98         o.intpk = getPK2(id);
99         o.stringpk = getPK3(id);
100         o.stringvalue = getValue(id);
101         return o;
102     }
103
104     static public LongIntStringOid createOid(int id) {
105         return new LongIntStringOid(id);
106     }
107
108     @Override
109     public String toString() {
110         StringBuffer result = new StringBuffer();
111         result.append("LongIntStringPK[");
112         result.append(longpk);
113         result.append(",");
114         result.append(intpk);
115         result.append(",\"");
116         result.append(stringpk);
117         result.append("\"]: ");
118         result.append(stringvalue);
119         result.append(".");
120         return result.toString();
121     }
122
123 }
124