]> review.fuel-infra Code Review - packages/trusty/mysql-wsrep-5.6.git/blob
6c05c86f4281ba92682cce5f6eafba872deb43af
[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 java.util.List;
23 import javax.persistence.OneToMany;
24
25 /** Schema
26  *
27 create table longlongstringpk (
28  longpk1 bigint not null,
29  longpk2 bigint not null,
30  stringpk varchar(10) not null,
31  stringvalue varchar(10),
32         CONSTRAINT PK_longlongstringpk PRIMARY KEY (longpk1, longpk2, stringpk)
33
34 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
35  */
36 @javax.persistence.Entity
37 @javax.persistence.Table(name="longlongstringpk")
38 @javax.persistence.IdClass(value=LongLongStringOid.class)
39 public class LongLongStringPK extends LongLongStringConstants implements Serializable {
40
41     @javax.persistence.Id
42     @javax.persistence.Column(name="longpk1")
43     private long longpk1;
44
45     @javax.persistence.Id
46     @javax.persistence.Column(name="longpk2")
47     private long longpk2;
48
49     @javax.persistence.Id
50     @javax.persistence.Column(name="stringpk")
51     private String stringpk;
52
53     @javax.persistence.Column(name="stringvalue")
54     private String stringvalue;
55
56     public LongLongStringPK() {
57     }
58
59     public long getLongpk1() {
60         return longpk1;
61     }
62
63     public void setLongpk1(long value) {
64         longpk1 = value;
65     }
66
67     public long getLongpk2() {
68         return longpk2;
69     }
70
71     public void setLongpk2(long value) {
72         longpk2 = value;
73     }
74
75     public String getStringpk() {
76         return stringpk;
77     }
78
79     public void setStringpk(String value) {
80         stringpk = value;
81     }
82
83     static public LongLongStringPK create(int id) {
84         LongLongStringPK o = new LongLongStringPK();
85         o.longpk1 = getPK1(id);
86         o.longpk2 = getPK2(id);
87         o.stringpk = getPK3(id);
88         o.stringvalue = getValue(id);
89         return o;
90     }
91
92     static public LongLongStringOid createOid(int id) {
93         return new LongLongStringOid(id);
94     }
95
96     @Override
97     public String toString() {
98         StringBuffer result = new StringBuffer();
99         result.append("LongLongStringPK[");
100         result.append(longpk1);
101         result.append(",");
102         result.append(longpk2);
103         result.append(",\"");
104         result.append(stringpk);
105         result.append("\"]: ");
106         result.append(stringvalue);
107         result.append(".");
108         return result.toString();
109     }
110
111 }
112