2 Copyright 2010 Sun Microsystems, Inc.
3 All rights reserved. Use is subject to license terms.
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.
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.
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
19 package com.mysql.clusterj.jpatest.model;
21 import java.io.Serializable;
22 import java.util.List;
23 import javax.persistence.OneToMany;
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)
34 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
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 {
42 @javax.persistence.Column(name="longpk1")
46 @javax.persistence.Column(name="longpk2")
50 @javax.persistence.Column(name="stringpk")
51 private String stringpk;
53 @javax.persistence.Column(name="stringvalue")
54 private String stringvalue;
56 public LongLongStringPK() {
59 public long getLongpk1() {
63 public void setLongpk1(long value) {
67 public long getLongpk2() {
71 public void setLongpk2(long value) {
75 public String getStringpk() {
79 public void setStringpk(String value) {
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);
92 static public LongLongStringOid createOid(int id) {
93 return new LongLongStringOid(id);
97 public String toString() {
98 StringBuffer result = new StringBuffer();
99 result.append("LongLongStringPK[");
100 result.append(longpk1);
102 result.append(longpk2);
103 result.append(",\"");
104 result.append(stringpk);
105 result.append("\"]: ");
106 result.append(stringvalue);
108 return result.toString();