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 javax.persistence.OneToOne;
26 drop table if exists longintstringpk;
27 create table longintstringpk (
28 longpk bigint not null,
30 stringpk varchar(10) not null,
31 stringvalue varchar(10),
32 CONSTRAINT PK_longintstringpk PRIMARY KEY (longpk, intpk, stringpk)
34 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
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 {
43 @javax.persistence.Column(name="longpk")
47 @javax.persistence.Column(name="intpk")
51 @javax.persistence.Column(name="stringpk")
52 private String stringpk;
54 @javax.persistence.Column(name="stringvalue")
55 private String stringvalue;
57 @OneToOne(mappedBy = "longIntStringPKOneOne")
58 private LongIntStringFKOneOne longIntStringFKOneOne;
60 public LongIntStringPKOneOne() {
63 public Long getLongpk() {
67 public void setLongpk(Long value) {
71 public int getIntpk() {
75 public void setIntpk(int value) {
79 public String getStringpk() {
83 public void setStringpk(String value) {
87 public LongIntStringFKOneOne getLongIntStringFKOneOne() {
88 return longIntStringFKOneOne;
91 public void setLongIntStringFKOneOne(LongIntStringFKOneOne value) {
92 longIntStringFKOneOne = value;
95 static public LongIntStringPKOneOne create(int id) {
96 LongIntStringPKOneOne o = new LongIntStringPKOneOne();
97 o.longpk = getPK1(id);
99 o.stringpk = getPK3(id);
100 o.stringvalue = getValue(id);
104 static public LongIntStringOid createOid(int id) {
105 return new LongIntStringOid(id);
109 public String toString() {
110 StringBuffer result = new StringBuffer();
111 result.append("LongIntStringPK[");
112 result.append(longpk);
114 result.append(intpk);
115 result.append(",\"");
116 result.append(stringpk);
117 result.append("\"]: ");
118 result.append(stringvalue);
120 return result.toString();