19 package com.mysql.clusterj.jpatest.model;
21 import java.io.Serializable;
22 import java.io.ObjectInputStream;
23 import java.io.ObjectOutputStream;
24 import java.io.IOException;
25 import java.util.Collection;
26 import java.util.HashSet;
31 @javax.persistence.Entity
32 @javax.persistence.Table(
name=
"a")
33 public class A implements Serializable {
38 static private final long serialVersionUID = -3359921162347129079L;
49 private double cdouble;
53 @javax.persistence.OneToMany(mappedBy=
"a")
54 private Collection<B0> b0s =
new HashSet<B0>();
60 static public A 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 setCfloat(
float cfloat) {
100 this.cfloat = cfloat;
103 public double getCdouble() {
107 public void setCdouble(
double cdouble) {
108 this.cdouble = cdouble;
111 public String getCstring() {
115 public void setCstring(
String cstring) {
116 this.cstring = cstring;
119 public Collection<B0> getB0s() {
123 public void setB0s(Collection<B0> b0s) {
127 private void writeObject(ObjectOutputStream out)
throws IOException {
128 out.defaultWriteObject();
131 private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
132 in.defaultReadObject();
135 static public class Oid
implements Serializable {
143 public boolean equals(Object obj) {
144 if (obj == null || !this.getClass().equals(obj.getClass()))
147 return (this.
id == o.id);
151 public int hashCode() {
157 public String toString() {
159 buffer.append(
"A id: ");
161 buffer.append(
"; cint: ");
163 buffer.append(
"; clong: ");
164 buffer.append(clong);
165 buffer.append(
"; cfloat: ");
166 buffer.append(cfloat);
167 buffer.append(
"; cdouble: ");
168 buffer.append(cdouble);
169 buffer.append(
"; cstring: ");
170 buffer.append(cstring);
171 buffer.append(
"; collection<b0>(");
172 int size = b0s.size();
174 buffer.append(
"): [");
177 buffer.append(separator);
178 buffer.append (b.getId());
182 return buffer.toString();