• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock exam about isIdentical

 
Deep Chand
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For 2 Entity Bean objects with the same primary key but from different homes, will isIdentical() return true or false?

I think it should be false.

deep
 
amol deshpande
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right.
Amol.
 
Mikalai Zaikin
Ranch Hand
Posts: 3371
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure,

it is like have

PK1 = Integer(1)
PK2 = Integer(1)

PK1 equals to PK2

and

EJB1 = AddressBean (has the PK1 key)
EJB2 = PersonBean (has the PK2 key)

EJB1 is not identical to EJB2.

regards,
MZ
[ March 24, 2005: Message edited by: Mikalai Zaikin ]
 
Deep Chand
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mikalai,

Correct but when I said 'same home', I meant same entity bean type i.e. both the objects are of PersonBean but from different homes. I have this doubt because if a bean is deployed twice, each will have a different home.

Please reply.
Deep
 
Muhammad Faisal
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both of them must come from same home and should be pointing towards the same entity. By Entity, i mean , Primary Key's object data that uniquly identifies it in the database. For example Bean 1(#88) ,Bean 2 (#88) , Bean 3 (#98), Bean 4(#299) . Consider these are all beans with primary key values in parenthesis. When you run isIdentical on Bean 1 and 2 , it should return true bcaz Bean 1 and 2 are sharing the same primary key object. For all others it will return false. I assume all of them are coming from the same home.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic