We went down this path once with our current project and learned that it
became a rather large pain. Granted are project was runnng behind and we
didn't have the staff to put sufficient time in it, but what we found were
two things:
1. A ton of views, which isn't necessarily a bad thing, but it does add a
lot for the developer to use what's out there.
2. New developer confusion. New developers would end up seeing a very large
datamodel they need to learn and a confusion on why we are getting data from
this entity EJB, but updating through others.
Again, we were not given the time to really sit down and think about what
views we need or a good naming standard for entity EJB's going against a
view. But, my main problem with the entity bean is that I find it hard to
believe that Sun's plan was to make an object map of our relational
databases. I think having an entity EJB for each table is not a good design
because that simply is not the way our object models work. I know it is
your typical OO to relational argument and I know that ejb 1.1 allows
dependent objects, but I just don't think the entity bean is their yet.
They create a ton more sql calls than if I simply do my own sql objects for
any type of big criteria searches. I for one only use finder methods when a
single row is returned. When more than one row is returned the overhead is
too much for me to take. I use my stateless session EJB to dynamically load
a sql object of mine to do the sql. This way, if I swap db's or whatever, I
can create a new sql object very easily and have the session bean now use
the new one with only compiling the new sql object. I do use container
managed transactions and do very much like the EJB session beans.
I do not claim to be an expert in any way, these are just my opinions from
my experience. My experience so far is with Apache, JRun, and Jonas 1.6 as
the container. I have not had time yet to get into Orion, but plan to soon.
The reason I haven't got into Orion yet is I don't have time to jump in and
battle with it with no real documentation. I do not like Jonas either. It
was chosen by my client because they are really into the free open source
stuff.
Let me know if you think I am way off base as would loved to get other
opinions and maybe learn something new.
Dale
----- Original Message -----
From: Brian Cunningham <[EMAIL PROTECTED]>
To: Orion-Interest <[EMAIL PROTECTED]>
Sent: Tuesday, April 04, 2000 7:32 PM
Subject: RE: Is CMP is useless?
> RE:
> "On the other hand, if
> you want to CMP, your simple example will take at least 3 sql calls."
>
> Or: one view and one sql call.
>
> Remember that an entity EJB can be viewed viewed as a *record* in a table
(a
> collection of length 1) or as a collection of records. So, think of your
> view as a read only table and your associated CMP as a read only record.
> Then imagine that given the right criteria (the right where clause) your
> custom find method can return multiple records (a collection of length n).
>
> The natural next question is how to deal with the n entities in the
returned
> collection. Well, that depends on the type of collection returned right?
And
> I'm guessing that it's an array of strings...but I don't know yet.
>
> The where clauses go in the deployment descriptor, the custom find methods
> go in the home inteface. Here's a deployment descriptor example from
> Weblogic 4.5:
>
> <SNIP>
> (finderDescriptors
> "findAccount(double balanceEqual)" "(= balance $balanceEqual)"
> ; This is converted to a "findAccount" method in
> ; the generated persistent storage class, which returns
> ; returns a bean of this class that satisfies this expression.
>
> "findBigAccounts(double balanceGreaterThan)" "(> balance
> $balanceGreaterThan)"
> ; This is converted to a "findBigAccounts" method
> ; in the generated persistent storage class, which
> ; returns an enumeration of beans of this class
> ; that satisfy this expression.
>
> "findOrderedBigAccounts(double balanceGreaterThan)" "(orderBy 'id'
(>
> balance $balanceGreaterThan))"
> ; This is converted to a "findOrderedBigAccounts" method
> ; in the generated persistent storage class, which
> ; returns an enumeration of beans of this class
> ; that satisfy this expression, ordered by the column 'id'.
>
> "findDescOrderedBigAccounts(double balanceGreaterThan)" "(orderBy
'id
> desc' (> balance $balanceGreaterThan))"
> ; This is converted to a "findDescOrderedBigAccounts" method
> ; in the generated persistent storage class, which
> ; returns an enumeration of beans of this class
> ; that satisfy this expression, in descending order by the column
> 'id'.
>
> "findNullAccounts()" "(isNull type)"
> ; This is converted to a "findNullAccounts" method
> ; in the generated persistent storage class, which
> ; returns an enumeration of beans of this class
> ; that have a name that is null.
>
> ); end finderDescriptors
> </SNIP>
>
> I'll try to post an example of using the returned Collection (or
> enumeration...) tomorrow for those who care.
>
> Anyone got a sample already? One that is deployed in XML/Orion style?
>
> Brian Cunningham
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Dale Bronk
> Sent: Tuesday, April 04, 2000 12:05 PM
> To: Orion-Interest
> Subject: Re: Is CMP is useless?
>
>
> You need to weigh your points against portability and efficiency. If you
> use ANSI SQL, portability should not be a problem. On the other hand, if
> you want to CMP, your simple example will take at least 3 sql calls.
>
>
> ----- Original Message -----
> From: Alex Paransky <[EMAIL PROTECTED]>
> To: Orion-Interest <[EMAIL PROTECTED]>
> Sent: Tuesday, April 04, 2000 12:10 PM
> Subject: RE: Is CMP is useless?
>
>
> > But using stateless session beans to execute SQL means you have to embed
> the
> > SQL commands in to your code. This breaks the model that CMP is trying
to
> > achieve. If someone is to move your bean in to a different environment
> they
> > might not be able to alter the code to make changes to the SQL.
> >
> > Suppose that someone is trying to adapt your Employee bean to be used in
> > their enterprise system. They follow the CMP procedure with their EJB
> > server to map Employee attributes to columns in their own table.
However,
> > they are not able to do the same with the session bean which has SQL in
> it.
> >
> > I suppose that the bean's environment can be used to hold the specific
> SQL,
> > with parameter replacements, however, this seems out of place with the
CMP
> > model.
> >
> > -AP_
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Galina
> > Sokolova
> > Sent: Tuesday, April 04, 2000 8:40 AM
> > To: Orion-Interest
> > Subject: RE: Is CMP is useless?
> >
> >
> >
> > From my experience stateless session bean is a better choice for complex
> > lookups, especially
> > if they return enumeration of objects.
> >
> >
> >
> >
> >
> >
> > [EMAIL PROTECTED] (Josh Sanderson)@itglink.com> on 04/04/2000
> 10:49:17
> > AM
> >
> > To: Orion-Interest <[EMAIL PROTECTED]>
> > cc:
> >
> > Subject: RE: Is CMP is useless?
> >
> >
> > I don't know....I never thought Employees and sex mixed that well
> > anyways....
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Alex Paransky
> > Sent: Monday, April 03, 2000 9:04 PM
> > To: Orion-Interest
> > Subject: Is CMP is useless?
> >
> >
> > Is it my imagination, but the minute any kind of complex finding is
> > required
> > on an entity bean, CMP becomes useless. For example, I have entities
> > called
> > EMPLOYEE, PERSON, and SEX (M/F/Other you know).
> >
> > EMPLOYEE is a PERSON with SEX.
> >
> > I have a function in EmployeeHome, findFemaleEmployees(). How do I
> > implement this with CMP? The query has to do something like:
> >
> > SELECT EMPLOYEE_ID FROM EMPLOYEE, PERSON, SEX WHERE SEX.TYPE="F" AND
> > EMPLOYEE.ID=PERSON.ID AND PERSON.SEX_ID = SEX.ID
> >
> > Please note that SEX.ID is not the same as SEX.TYPE.
> >
> > Can this be done with CMP or do I need to use BMP? If the answer is use
> > BMP
> > (and this is such a TRIVIAL) example, that it seems CMP is pretty much
> > useless.
> >
> > -AP_
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
>