2 Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 package com.mysql.clusterj.jpatest.model;
20 import java.io.Serializable;
21 import java.io.ObjectInputStream;
22 import java.io.ObjectOutputStream;
23 import java.io.IOException;
26 * An Entity test class.
28 @javax.persistence.Entity
29 @javax.persistence.Table(name="b0")
30 public class B0 implements Serializable {
31 // @Basic(fetch=EAGER) is the default mapping annotation
32 // for primitive types, wrappers, String...
35 static private final long serialVersionUID = 4644052765183330073L;
46 private double cdouble;
48 private String cstring;
52 @javax.persistence.ManyToOne
53 @javax.persistence.Column(name="a_id")
54 @org.apache.openjpa.persistence.jdbc.Index(name="FK_a_id")
60 static public B0 create(int id) {
65 o.setCfloat((float)id);
66 o.setCdouble((double)id);
67 o.setCstring(String.valueOf(id));
75 public void setId(int id) {
79 public int getCint() {
83 public void setCint(int cint) {
87 public long getClong() {
91 public void setClong(long clong) {
95 public float getCfloat() {
99 public void setBytes(byte[] value) {
103 public byte[] getBytes() {
107 public void setCfloat(float cfloat) {
108 this.cfloat = cfloat;
111 public double getCdouble() {
115 public void setCdouble(double cdouble) {
116 this.cdouble = cdouble;
119 public String getCstring() {
123 public void setCstring(String cstring) {
124 this.cstring = cstring;
131 public void setA(A a) {
135 private void writeObject(ObjectOutputStream out) throws IOException {
136 out.defaultWriteObject();
139 private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
140 in.defaultReadObject();
143 static public class Oid implements Serializable {
151 public boolean equals(Object obj) {
152 if (obj == null || !this.getClass().equals(obj.getClass()))
155 return (this.id == o.id);
159 public int hashCode() {
165 public String toString() {
166 StringBuffer buffer = new StringBuffer();
167 buffer.append("B0 id: ");
169 buffer.append("; cint: ");
171 buffer.append("; clong: ");
172 buffer.append(clong);
173 buffer.append("; cfloat: ");
174 buffer.append(cfloat);
175 buffer.append("; cdouble: ");
176 buffer.append(cdouble);
177 buffer.append("; cstring: ");
178 buffer.append(cstring);
179 buffer.append("; a: ");
181 return buffer.toString();