You might want to look at the June 2000 issue of Java Developer's Journal,
there is an article there on BMP Persistence using Proxies. It's got a nice
implementation of lazy load for dependent objects.
Cheers
Jay Walters
-----Original Message-----
From: Aprameya Paduthonse [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 01, 2001 5:20 PM
To: [EMAIL PROTECTED]
Subject: Re: bean design problem for one to many relationship
I agree with Cuvillier. BMP looks like a cleaner implementation.
ContacInfo does not exist without a Person. So it is not necessary to
implement ContactInfo as an EJB. You can make it a helper class and make
Person a BMP Entity EJB. (That way your helper class will use less resources
than that of an entity bean.) Person will then contain an ArrayList of
ContactInfo objects. In your ejbCreate/ebjLoad/ejbStore/ejbRemove methods
you'll need to perform JDBC operations as you loop through the elements in
this ArrayList.
basically your original suggestion...
-----Original Message-----
From: Jianguo Wang [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 01, 2001 4:59 PM
To: [EMAIL PROTECTED]
Subject: Re: bean design problem for one to many relationship
Hi Tibo,
You mention that "There is some limitation using BLOB on some application
servers (such as
with WLS)" I am using WLS. Would you please say a little bit more what the
limitation is? or
recommend me some references to me about this?
Thanks a lot.
-John
-----Original Message-----
From: Thibault Cuvillier [SMTP:[EMAIL PROTECTED]]
Sent: Thursday, February 01, 2001 3:44 PM
To: [EMAIL PROTECTED]
Subject: Re: bean design problem for one to many relationship
Using serialization to store data in an RDBMS is an horrible and
hugly solution ! ;)o
If the structure of your serialized object changed, you will not be able
to reload the serialized object from the DB.
Serialization should be never used for long-term storage.
There is some limitation using BLOB on some application servers (such as
with WLS)
Tibo.
>-----Original Message-----
>From: Juan Lorandi (Chile) [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, February 01, 2001 2:00 PM
>To: [EMAIL PROTECTED]
>Subject: Re: bean design problem for one to many relationship
>
>
>yes, you can use object's in CMP...
>I do that all the time with Orion Server
>just define the field as java.lang.Object, and the container's
>persistance
>manager
>will serialize the object and store it in a BLOB field in the
>database (for
>Oracle, for Sybase & SQL Server it will be image or varbinary).
>
>HTH
>
>JP
>
>PS: Of course, if you try to access the DB directly thru SQL,
>you will have
>to deserialize
>the Object manually. This will present additional difficulties
>if you aren't
>using Java.
>
>> -----Original Message-----
>> From: Jianguo Wang [mailto:[EMAIL PROTECTED]]
>> Sent: Jueves, 01 de Febrero de 2001 16:47
>> To: [EMAIL PROTECTED]
>> Subject: Re: bean design problem for one to many relationship
>>
>>
>> Hi,
>>
>> When you say that I can put ContactInfo in a Person member, you mean
>> to use BMP, don't you? To my understanding, it is impossible
>> to use object
>> as a member in CMP because it can not match a object with a
>> field in the table.
>>
>> Please verify it for me.
>>
>> -John
>>
>> -----Original Message-----
>> From: Juan Lorandi (Chile) [SMTP:[EMAIL PROTECTED]]
>> Sent: Thursday, February 01, 2001 12:56 PM
>> To: [EMAIL PROTECTED]
>> Subject: Re: bean design problem for one to many relationship
>>
>> With this design, you could easily have 2 CMP beans that do
>> just what you
>> want.
>> Alternatively, if contact info will only be accesible thru
>> Person, you could
>> store all ContactInfo
>> in a Person member:
>>
>> (very PSEUDO pseudo-code)
>> public class ContactInfo extends Object {
>> public String UID;
>> public String Type;
>> public String Detail;
>> }
>>
>> and in Person:
>>
>> ..
>> public Vector contactInfoCollection;
>> ..
>>
>> public addContact(ContactInfo contact);
>> {
>> contactInfoCollection.add(ContactInfo);
>> }
>>
>>
>> HTH
>>
>> JP
>> > -----Original Message-----
>> > From: Jianguo Wang [mailto:[EMAIL PROTECTED]]
>> > Sent: Jueves, 01 de Febrero de 2001 14:42
>> > To: [EMAIL PROTECTED]
>> > Subject: bean design problem for one to many relationship
>> >
>> >
>> > Dear friends,
>> >
>> > I have a design problem about one to many relationship. Can
>> > anyone there give me
>> > some suggestions,
>> >
>> > For simplicity's sake, let's say I have two tables
>> > Person(UID, FirstName, LastName)
>> > with primary key (UID) and ContactInfo(UID, Type, Detail)
>> > with primary key (UID, Type).
>> > A person may have more than one ContactInfo. For example,
>> >
>> > A record in the table "Person" is (777, John, Smith)
>> > Corresponding to this person, there are two records in the
>> > table "ContacInfo" like
>> > (777, Email, [EMAIL PROTECTED])
>> > (777, Phone, (850)123-4567)
>> >
>> > These information are provided at a time and can be saved in
>> > array (mainly ContactInfo).
>> > When I try to insert them into database, can I implement it
>> > as CMP? or I have to
>> > implement it as BMP? If I can do with CMP, does it mean that
>> > I have to make a loop
>> > to invoke home.create(UID, Type, Detail)?
>> >
>> > Thank you very much.
>> >
>> > -John
>> >
>>
>> ==============================================================
>> =============
>> 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".
>>
>
>===============================================================
>============
>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".
>
===========================================================================
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".
===========================================================================
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".
===========================================================================
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".
===========================================================================
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".