01: /**
02: * Copyright (C) 2001-2005 France Telecom R&D
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library 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 GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */package org.objectweb.speedo.ejb.pobjects.basic;
18:
19: import junit.framework.Assert;
20:
21: import java.io.Serializable;
22:
23: import javax.persistence.Basic;
24: import javax.persistence.Entity;
25: import javax.persistence.Id;
26: import javax.persistence.IdClass;
27: import javax.persistence.Table;
28:
29: import org.objectweb.speedo.ejb.pobjects.basic.CompPk;
30:
31: /**
32: * This class defines an embedded composite PK identifier.
33: * @author P. Dechamboux
34: */
35: @Entity
36: @Table(name="EJB_COMPPKID")
37: @IdClass(CompPk.class)
38: public class CompPkId implements Serializable {
39: @Id
40: private int pkv1;
41: @Id
42: private String pkv2;
43: @Basic
44: private int int_field;
45:
46: public void assign(long longval) {
47: this .int_field = (int) longval;
48: }
49:
50: public void check(long longval) {
51: Assert.assertEquals("bad int_field value", int_field,
52: (int) longval);
53: }
54:
55: public int retrieve_int_field() {
56: return int_field;
57: }
58:
59: public void assign_int_field(int int_field) {
60: this.int_field = int_field;
61: }
62: }
|