Hi,
I've been reading up on the Sun J2EE tutorial. One of the topics there is bean or container managed persistence. It states that container managed is easier for developers and allows for more portability. The class codes are much smaller compared to bean managed and developers need not worry about database queries.
Can anyone share their experiences on this? Any 'Real World' advantages and disadvantages? Is there a guideline I can follow when to use bean or container managed persistence?
Thanks,
-Ray
-
Container or Bean Managed Persistence (4 messages)
- Posted by: Ray V
- Posted on: October 31 2003 01:43 EST
Threaded Messages (4)
- RE: Container or Bean Managed Persistence by Valery Silaev on October 31 2003 16:33 EST
- DAO pattern (Data Access Objects) by Sean Sullivan on October 31 2003 20:19 EST
- DAO pattern (Data Access Objects) by Hans Schw?bli on November 05 2003 10:16 EST
- What is JDO? by Ray V on November 07 2003 02:24 EST
- DAO pattern (Data Access Objects) by Hans Schw?bli on November 05 2003 10:16 EST
-
RE: Container or Bean Managed Persistence[ Go to top ]
- Posted by: Valery Silaev
- Posted on: October 31 2003 16:33 EST
- in response to Ray V
As of EJB 2.0, if you are using CMP be aware of:
1. No portable way to sort query results (have you ever consider in-memory sorting?)
2. No portable / efficient way to select "page" of result
3. No date type support in EJB QL
5. No portable aggregate functions in EJB QL (MIN / MAX / COUNT / AVG)
6. Lack of convenient SQL functions in EJB QL
7. It's hard to express inheritance (same is true for BMP)
8. No portable/simple way to safely mix CMP & direct JDBC calls that modifies same data. Especially within bounds of same transaction. Partly applied to EJB.
9. Portability is sold out for cost of maintenance of several vendor-specific deployment descriptors and intensive testing in several environments (fabulous mantra WRITE ONCE DEBUG EVERYWHERE fully applied)
10. Either implementation of CMP engines are far from superior but free, or they quite well and costly and hardly portable if you are using vendor-specific optimizations.
BMP. Forget about this. Completely suxx in terms of performance and are devil complex to implement massively. You'll end up resorting to implement "trivial and natural" things like relations, solving 1+N load problem (1 query for keys & N for every record). It's a legacy of black EJB 1.1 days. Well, unless you are using something like TopLink. Anyway, if you have TopLink you have plain TopLink / JDO / CMP options, and they are very viable.
Give JDO a try. Consider some alternate O/R mapping tools (Hibernate*****, Cayenne****, something else). For majority (by number) of projects Entity Beans & CMP is overkill.
VS -
DAO pattern (Data Access Objects)[ Go to top ]
- Posted by: Sean Sullivan
- Posted on: October 31 2003 20:19 EST
- in response to Ray V
My company has many existing tables in DB2, Oracle, and Informix.
We decided against EJB Entity BMP.
Instead, we are using the DAO pattern to access the data.
Take a look at:
http://wiki.java.net/bin/view/Javapedia/DataAccessObject -
DAO pattern (Data Access Objects)[ Go to top ]
- Posted by: Hans Schw?bli
- Posted on: November 05 2003 10:16 EST
- in response to Sean Sullivan
Forget about CMP and BMP. We use it and it is the hell in my eyes. Of course noone wants to take responsibility for the bad decision.
I think you are much better off with JDO, Hibernate or any other good Object Relational Mapper. You can use them within the J2EE environment. By choosing JDO you don't need to spend a lot of money for Bea Weblogic. You can use JBoss, because it doesn't matter on CMP performance if you use JDO. -
What is JDO?[ Go to top ]
- Posted by: Ray V
- Posted on: November 07 2003 14:24 EST
- in response to Hans Schw?bli
What is JDO? Where can I get download it? Where can I get more info.
Thanks,
-Ray