I have an class that is an enumerated type:
public class MyType implements Serializable {
public final static MyType TYPE1 = new MyType();
public final static MyType TYPE2 = new MyType();
...
}
When I use this type in a business object that is returned from a session bean method, the type is broken. I understand why, because I'm using references which are equal only in the same process. So my question is how can I implement an enumerated type that will work with EJB (for remote calls)? Is there a pattern for this?
Michael
-
Using enumerated types with EJBs (2 messages)
- Posted by: Michael Mattox
- Posted on: March 11 2002 08:37 EST
Threaded Messages (2)
- Using enumerated types with EJBs by Kapil Israni on March 11 2002 13:43 EST
- Using enumerated types with EJBs by Tom Davies on March 11 2002 18:33 EST
-
Using enumerated types with EJBs[ Go to top ]
- Posted by: Kapil Israni
- Posted on: March 11 2002 13:43 EST
- in response to Michael Mattox
Well u can pass constant string as contstructor parameters for MyType object. And then override the equals method which compares the equality of the string. -
Using enumerated types with EJBs[ Go to top ]
- Posted by: Tom Davies
- Posted on: March 11 2002 18:33 EST
- in response to Michael Mattox
You need to use the canonical Java enumerated type pattern, which works with serialisation.
See Bloch's book 'Effective Java'
Tom