CMP entity bean
2 posts in topic
Flat View  Flat View

Posted By:   Abhishek_Agrawal
Posted On:   Thursday, February 28, 2002 10:31 AM

I just started learning entity beans. I saw finder methods need to be declared in home interface and implemented in deployment descriptor. What if i need to implement some complex query can i write that in deployment descriptor or should i go for BMP entity bean.
Thank in advance!!.

Re: CMP entity bean

Posted By:   Noel_Byron  
Posted On:   Friday, March 1, 2002 05:35 AM

With EJB 2.0 you can use the EJB query language. With EJB 1.1 your application server vendor should provide a tool to create such queries.

But think about this: a find method returns a bunch of primary keys. After that you would have to create a entity bean for each of the returned keys! That is nonsens. Imagine you need to fetch 100 rows. That means you access the database with 100 different selects. Not to mention the communication overhead from your client to the appliaction server.

That means you will end up with a session bean that does one select to supply your client with the data of several rows. Look at all those 'design patterns' addressing this issue on the web and forget about the find methods returning several keys.

I would recommend you to read this article:

Kind regards and good luck


Re: CMP entity bean

Posted By:   AlessandroA_Garbagnati  
Posted On:   Friday, March 1, 2002 01:38 AM


It depends how complex is that. You can use The EJB Query Language (FAQ: What is EJB QL?), but still you have some limits.

If you need to go beyond these limits you have to approach the problem in a different way, maybe with the help of Session beans.
About | Sitemap | Contact