users@glassfish.java.net

Re: override equals or hashcode on Stateful or stateless bean

From: Cheng Fang <Cheng.Fang_at_Sun.COM>
Date: Wed, 17 Oct 2007 12:00:54 -0400

In EJB 3, equals and hashcode methods are defined to have specific behaviors (see EJB 3.0 spec for more details). You should not override these methods. Chances are, if you do override them, they make no difference on the client side.

Your best bet is, for stateful beans, to encapsulate state in a custom data structure and expose it via business method. Then you can operate on the POJO data object.

-cheng

----- Original Message -----
From: glassfish_at_javadesktop.org
Date: Wednesday, October 17, 2007 11:21 am
Subject: override equals or hashcode on Stateful or stateless bean
To: users_at_glassfish.dev.java.net


> Hiya,
>
> Is it possible to override the equals method on a stateful bean.
> Otherwise, a collection on the other end cannot execute a host of
> useful methods like contains.
>
> Thanks,
>
> Shri
> [Message sent by forum member 'shriram' (shriram)]
>
> http://forums.java.net/jive/thread.jspa?messageID=240690
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>