Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Interest »

Re: can CMP return many records at once?

Milen Dyankov

2003-07-02

Replies:

Thanks a lot Suresh,

I was under the wrong impression that ejbSelect methods are simply
something like local (internal) version of finder methods.

It looks so obvious to me now. I really should read more careful next
time.

Thanks again,
    Milen



On Wed, 2003-07-02 at 12:47, Rangarajan , Suresh ( Cognizant ) wrote:
> Hi,
>  You've missed something in the spec. :D
> Read more about the ejbSelect<> methods.
> but select methods are not visible to the clients...
>
>
>
> -----Original Message-----
> From: Milen Dyankov [mailto:mdyankov@(protected)]
> Sent: Wednesday, July 02, 2003 3:53 PM
> To: J2EE-INTEREST@(protected)
> Subject: can CMP return many records at once?
>
>
> Hi,
> I'm relatively new to J2EE.
> I have read the specs and docs and there is something I don't really
> understand.
>
> As far as I understood all CMP's finder methods with return type
> Collection, simply return collection of primary keys. Then one need to
> create a new instance of this CMP to obtain the specific data.
>
> Lets say I have DB table called "UserHistory":
>
> userid | datetime       | action
> -------+-------------------+----------------
> 1    | 2003-03-03 13:25 | something
> 2    | 2003-03-03 14:27 | something else
> 1    | 2003-03-03 18:42 | something new
>
> with PRIMARY KEY (userid, datetime)
>
> Now if I'm writing J2EE application it would be helpful to have
> "UserHistoryCMP" as long as I'm using it for "what USER have done on
> DATE at TIME". But what if I would like to display a chart containing
> user's history.
>
> Doing "findAllByUserId(String user)" and then instantiating
> UserHistoryCMP for every record in the table, does not seems to be the
> right way of doing this. Or, is it?
>
> Or may be I should go for BMP in this case and simply write
> "getFullHistoryForUser (String user)" method in addition to default
> getters and setters? If so, does this mean that CMPs are only usable for
> getting single record and one should go for BMP any time when a large
> amount of records (returned at once) is required?
>
>
> Regards,
>      Milen
>
> ===========================================================================
> To unsubscribe, send email to listserv@(protected)
> of the message "signoff J2EE-INTEREST". For general help, send email to
> listserv@(protected)".
>

===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".



©2008 junlu.com - Jax Systems, LLC, U.S.A.