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.Collection;
23 import java.util.List;
24 import javax.persistence.OneToMany;
28 create table longlongstringpk (
29 longpk1 bigint not null,
30 longpk2 bigint not null,
31 stringpk varchar(10) not null,
32 stringvalue varchar(10),
33 CONSTRAINT PK_longlongstringpk PRIMARY KEY (longpk1, longpk2, stringpk)
35 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
37 @javax.persistence.Entity
38 @javax.persistence.Table(name="longlongstringpk")
39 @javax.persistence.IdClass(value=LongLongStringOid.class)
40 public class LongLongStringPKOneMany extends LongLongStringConstants implements Serializable {
43 @javax.persistence.Column(name="longpk1")
47 @javax.persistence.Column(name="longpk2")
51 @javax.persistence.Column(name="stringpk")
52 private String stringpk;
54 @javax.persistence.Column(name="stringvalue")
55 private String stringvalue;
57 @OneToMany(mappedBy = "longLongStringPKOneMany")
58 private Collection<LongLongStringFKManyOne> longLongStringFKManyOnes;
60 public LongLongStringPKOneMany() {
63 public long getLongpk1() {
67 public void setLongpk1(long value) {
71 public long getLongpk2() {
75 public void setLongpk2(long value) {
79 public String getStringpk() {
83 public void setStringpk(String value) {
87 public Collection<LongLongStringFKManyOne> getLongLongStringFKRelationships() {
88 return longLongStringFKManyOnes;
91 public void setLongLongStringFKRelationships(Collection<LongLongStringFKManyOne> value) {
92 longLongStringFKManyOnes = value;
95 static public LongLongStringPKOneMany create(int id) {
96 LongLongStringPKOneMany o = new LongLongStringPKOneMany();
97 o.longpk1 = getPK1(id);
98 o.longpk2 = getPK2(id);
99 o.stringpk = getPK3(id);
100 o.stringvalue = getValue(id);
104 static public LongLongStringOid createOid(int id) {
105 return new LongLongStringOid(id);
109 public String toString() {
110 StringBuffer result = new StringBuffer();
111 result.append("LongLongStringPK[");
112 result.append(longpk1);
114 result.append(longpk2);
115 result.append(",\"");
116 result.append(stringpk);
117 result.append("\"]: ");
118 result.append(stringvalue);
120 return result.toString();