Prev | Next

TOC | Index

J2EETM Developer's Guide
Entity Beans


Comparing Entity Beans

A client can determine if the object references of two entity beans are identical by invoking the isIdentical method:

Account accta, acctb;
. . .
if (accta.isIdentical(acctb))
   System.out.println("identical");

Or, the client can fetch and compare the primary keys of two entity beans:

String key1 = (String)accta.getPrimaryKey();
String key2 = (String)acctb.getPrimaryKey();

if (key1.compareTo(key2) == 0)
   System.out.println("equal");


Prev | Next

TOC | Index


Copyright © 2000 Sun Microsystems, Inc. All rights reserved.