MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Embedded.java
1 /*
2  Copyright 2010 Sun Microsystems, Inc.
3  All rights reserved. Use is subject to license terms.
4 
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.
8 
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.
13 
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
17 */
18 
19 package com.mysql.clusterj.jpatest.model;
20 
21 import java.io.Serializable;
22 import java.io.ObjectInputStream;
23 import java.io.ObjectOutputStream;
24 import java.io.IOException;
25 
26 import javax.persistence.Basic;
27 
42 @javax.persistence.Embeddable
43 public class Embedded implements Serializable {
44 
45  private static final long serialVersionUID = -7939440091193693312L;
46 
47  @Basic
48  private String name;
49 
50  @Basic
51  private int age;
52 
53  public Embedded() {
54  }
55 
56  public int getAge() {
57  return age;
58  }
59 
60  public void setAge(int age) {
61  this.age = age;
62  }
63 
64  public String getName() {
65  return name;
66  }
67 
68  public void setName(String name) {
69  this.name = name;
70  }
71 
72  private void writeObject(ObjectOutputStream out) throws IOException {
73  out.defaultWriteObject();
74  }
75 
76  private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
77  in.defaultReadObject();
78  }
79 
80  @Override
81  public String toString() {
82  StringBuffer buffer = new StringBuffer();
83  buffer.append("Embedded name: ");
84  buffer.append(name);
85  buffer.append("; age: ");
86  buffer.append(age);
87  return buffer.toString();
88  }
89 
90 }
91