It's perfectly possible (perhaps not a good choice regarding performance and
interoperability with other applications, but that's another matter). The only problem
is
WLS, which is unable to store Serializable fields to the database. You thus have four
options:
- choose another AppServer (for example, IAS, which does that without any problem)
- use an external OR mapping tool compatible with WLS, such as Toplink
- use BMP
- have another byte array field in your bean (ex : public byte[] serializedList). Mark
this
field as persistent in your DD, and mark your actual list as non-persistent. In
ejbStore(),
manually serialize your list into the serializedList array (using ObjectOutputStream
and
ByteArrayOutputStream), and in ejbLoad, deserialize the array and initialize the list
with
the result. This is annoying, but quite easy to do. So easy that I can't understand
why the
WLS container can't do it!
I would choose the first option ;-)
JB.
"Luis F. Canals" wrote:
> Hello,
>
> does anybody know how (and if is it possible) to store
> lists,trees,hashtables... using EJB and representing a tree, a list.. with
> an EJB? For example, when I've tried to do it with this CMP Entity Bean, the
> EJB server said me "I don't know how to map my_list to database" (I'm using
> WebLogic 5.1):
>
> class MyEJBLinkedList implements EntityBean {
> public Integer PK_MyEJBLinkedList; // The Primary Key
> public java.util.LinkedList my_list; // This is a Serializable
>object!!
>
> // The functions here are not important, the are very simple.
> }
>
> TIA
>
> Luis F. Canals Samaniego
> CEDETEL
> Parque Tecnol�gico de Boecillo
> Edificio Centro, Parcela 109
> E-47151 Boecillo (Valladolid)
>
> Tfno: +34 983 54 65 02
> Fax: +34 983 54 66 96
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
--
Jean-Baptiste Nizet
[EMAIL PROTECTED]
R&D Engineer, S1 Belgium
Kleine Kloosterstraat, 23
B-1932 Sint-Stevens Woluwe
+32 2 200 45 42
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".