Hi Cory...

I doubt we'll see anything thats database engine specific supported in CMP. 
I agree that sequences are extremely usefull and wish that there was a 
standard way on implementing them on database engines so that JDBC (and 
therefore J2EE) could take full advantage. PostgreSQL has a sequence and MS 
SQL Server has an identity field and so on. Unfortunatly, database vendors 
have no standard for implementing them.

You can write code to generate a unique value for a primary key. You could 
code up a session bean that uses JDBC to create a new record in a table 
with no fields but the identity field. Of course, this bean would be 
database specific and it would be used by the non-database specific CMP 
entity beans.

Orion makes a key generator available called counter.jar, which you can 
read about in the Orion FAQ (although I don't know what its licensing terms 
are - check this before you rely on it in your app).

Setting aside the question of sequence types and primary key generation, I 
have not yet run into a RDBMS data structure I don't think I could 
replicate using EJB 2.0 CMP. Even if I did, I could isolate part with BMP 
or session beans and use CMP for the rest. I expect if I found something so 
strange 2.0 CMP could not handle it that I would try to redesign it so that 
it could be handled. I would probably end up with a better and simpler 
design.

With EJB 2.0 CMP, I have a very good chance of getting my J2EE app to run 
on whatever database on whatever compliant server on whatever operating 
system. And, all the work it does for me is nice as well. Also, with EJB 
2.0, its entirely possible to create a tool that would let you draw a UML 
diagram and generate almost the entire back end of an app - deployment 
descripters, code, maybe everything but the QL- automatically and then make 
changes a snap. There is no such tool now, but give some time.

The best source of how to do CMP, unfortunatly, is still the spec.

Anyhow, I thought EJB 1.1 was of limited utility. I think 2.0 is much, much 
better and can probably handle most systems. Just my opinion.

Jim


--On Saturday, October 21, 2000 3:11 AM -0400 Cory Adams 
<[EMAIL PROTECTED]> wrote:

> Jim,
>
> How could a CMP managed entity bean handle a create for say an Oracle
> database table that used db specific sql for describing the key using a
> sequence?
>
> Where the sql itself might look like
>
> insert into customer (id, name, address) values(cust_sequence.NEXTVAL,
> "Jim" "12 Willow Street");
>
> Maybe this is trivial.....
>
> Better yet could I ask you to provide some of the sources of information
> that you use to help all of us better understand how to do CMP with
> perhaps complex RDBMS entity relationships?
>
> Thanks,
>
> Cory
>
> At 09:07 PM 10/20/00 -0400, Jim Archer wrote:
>> What types of relationships do you feel EJB 2.0 can't adequately
>> support? I  have been studying 2.0 CMP carefully, and it seems to be
>> quite powerfull.  There may be holes in it, but it can handle the
>> majority of real works  cases.
>>
>> Jim
>>
>>
>> --On Friday, October 20, 2000 12:28 PM -0700 [EMAIL PROTECTED] wrote:
>>
>>> If you don't use an object-relational mapping tool you're still in for a
>>> lot of hurt with EJB if you have a complex data model. I don't think CMP
>>> really addresses the kind of data models large systems have. Nor does
>>> the relationship support in EJB 2.0 either. I think you'll end up doing
>>> JDBC BMP with your Session and Entity beans. Performance is only an
>>> issue when you make everything a stateful session bean or an entity
>>> bean. There are rules for when it's appropriate to make things entity
>>> beans. There still isn't a whole lot of useful information around on
>>> design EJBs yet though with most of it only explaining the basics
>>> including the ORA book.
>>>
>>> On Fri, 20 Oct 2000, Duffey, Kevin wrote:
>>>
>>>> Thanks.
>>>>
>>>> I only meant to use the /classes folder because my ejb code is in the
>>>> same project as the rest of my code (Servlets, javabeans, action
>>>> classes, etc). Since it all compiles to the same one folder, I assume I
>>>> will have to "move" the ejb compiled classes every time I compile them.
>>>> What I was hoping for was a way to not have to do this..instead, just
>>>> let the whole project compile to the WEB-INF/classes folder (all my
>>>> code), and then have Orion pick up on the ejb changes from that point.
>>>> It appears to me from what everyone is saying I will have to use some
>>>> sort of script every time I make a change to an ejb, which my first
>>>> thoughts is a pain in the ass. Its very easy to develop servlets,
>>>> action classes, javabeans, core classes, but ejb not only requires 3
>>>> classes per component, but lots of "special" work just to get the thing
>>>> deployed. Then, every time you make a change, it requires the same
>>>> process. I would think turn-around time for ejb development is on the
>>>> order of a couple of minutes for every change you make. That results in
>>>> a lot slower development cycle than I am currently using.
>>>>
>>>> Worse, I have started hearing alot of people turn away from ejb and
>>>> going back to servlets because of development time, and performance.
>>>> Supposedly the ejb stuff isn't living up to all the hype. However, I
>>>> look at what the ejb container does for you (connection pooling,
>>>> transactions, security, instance pooling, etc) and it seems there is
>>>> alot of stuff I wont have to do on the side of persistence,
>>>> transactions and security..so maybe the extra time is worth it? ;)
>>>>
>>>> Anyways..I did as one person suggested in this list, I set up in my
>>>> application.xml like so:
>>>>
>>>> <module>
>>>>   <ejb>/path/www/WEB-INF/classes/</ejb>
>>>> </module>
>>>>
>>>> and Orion seems to be finding the classes (the ejb). However, I keep
>>>> seeing an error appear. It says something like:
>>>>
>>>> Error compiling class c:/path/www/WEB-INF/classes/  Login.java
>>>> LoginBean.java LoginHome.java  can't find method create()in
>>>> LoginBean.java
>>>>
>>>> Its a very strange message to me. If I change the <module> path, it
>>>> tells me it can't find the classes. If I delete the classes, it also
>>>> tells me it can't find them. So I assume the path is set correctly in
>>>> the module <ejb> tag..as it is finding the classes. I am just not sure
>>>> why the heck its giving me some compiler error..or why its even trying
>>>> to compile them..they are already compiled.
>>>>
>>>> Anyways..I'll keep plugging away.
>>>>
>>>>
>>>> > -----Original Message-----
>>>> > From: Stanislav Maximov [mailto:[EMAIL PROTECTED]]
>>>> > Sent: Thursday, October 19, 2000 6:34 PM
>>>> > To: Orion-Interest
>>>> > Subject: RE: EJB Help..
>>>> >
>>>> >
>>>> > Kevin,
>>>> > look inside the news-application example bundled with Orion,
>>>> > lots of things
>>>> > will become clear for you after that.
>>>> > <www-dir>/WEB-INF/classes directory is for servlet classes,
>>>> > not for EJBs.
>>>> > You'll see how to deploy EJBs in that example and in
>>>> > documentation as well.
>>>> >
>>>> > stas@
>>>> >
>>>> > > -----Original Message-----
>>>> > > From: [EMAIL PROTECTED]
>>>> > > [mailto:[EMAIL PROTECTED]]On Behalf Of
>>>> > Duffey, Kevin
>>>> > > Sent: Friday, October 20, 2000 3:45 AM
>>>> > > To: Orion-Interest
>>>> > > Subject: RE: EJB Help..
>>>> > >
>>>> > >
>>>> > > Thanks for the note. One thing..since I compile all of my
>>>> > classes into the
>>>> > > www/WEB-INF/classes dir, should I put a META-INF in the
>>>> > /classes dir, and
>>>> > > just point the module to the WEB-INF/classes folder? Would
>>>> > that work?
>>>> > >
>>>> > > Not that I want you to tell me everything, ok..I do, but
>>>> > what exactly do I
>>>> > > need to get EJB deployed in that way? My first stab that I
>>>> > want to do is
>>>> > > create a login process. I would like to use statless session
>>>> > > beans, and also
>>>> > > use an entity bean..using CMP. I created 3 classes, Login,
>>>> > LoginBean and
>>>> > > LoginHome. I have them in com.mycompany.ejb package. That
>>>> > compiles to
>>>> > > www/WEB-INF/classes dir. So do I make application.xml like so:
>>>> > >
>>>> > > <module>/www/WEB-INF/classes</module>
>>>> > >
>>>> > > where the com folder starts? Or do I actually have to point them
>>>> > > directly to
>>>> > > the .class files themselves? If the classes are compiled in
>>>> > a package, I
>>>> > > assume I need to point the ejb module setting to the root
>>>> > package right?
>>>> > > Furthermore, do I need that ejb.xml file in META-INF? If so, what
>>>> > > should it
>>>> > > be set to if I am using an expanded dir? Lastly, how the
>>>> > heck to I get the
>>>> > > entity bean added..is that a forth class, or a whole set of
>>>> > 3 different
>>>> > > classes, one being the entity bean, the other two being
>>>> > like the home and
>>>> > > remote objects? It seems kind of silly that I would need 6
>>>> > > classes to do the
>>>> > > login process..3 for the session/logic stuff, and 3 for the
>>>> > > entity/database
>>>> > > mapping.
>>>> > >
>>>> > > Thanks so much..I appreciate the help.
>>>> > >
>>>> > >
>>>> > > > -----Original Message-----
>>>> > > > From: Mike Cannon-Brookes [mailto:[EMAIL PROTECTED]]
>>>> > > > Sent: Thursday, October 19, 2000 3:39 PM
>>>> > > > To: Orion-Interest
>>>> > > > Subject: RE: EJB Help..
>>>> > > >
>>>> > > >
>>>> > > > Kevin,
>>>> > > >
>>>> > > > With any *ar file in Orion, you can use a directory instead.
>>>> > > >
>>>> > > > eg
>>>> > > > <module>
>>>> > > >      <ejb>./myejbs.jar</ejb>
>>>> > > > </module>
>>>> > > >
>>>> > > > can just be
>>>> > > >
>>>> > > > <module>
>>>> > > >      <ejb>./myejbs</ejb>
>>>> > > > </module>
>>>> > > >
>>>> > > > where ./myejbs is a directory structure which has the
>>>> > same structure
>>>> > > > (META-INF directories etc) as inside the myejbs.jar
>>>> > > >
>>>> > > > Mike
>>>> > > >
>>>> > > > -----Original Message-----
>>>> > > > From: [EMAIL PROTECTED]
>>>> > > > [mailto:[EMAIL PROTECTED]]On Behalf Of
>>>> > > > Duffey, Kevin
>>>> > > > Sent: Friday, October 20, 2000 5:37 AM
>>>> > > > To: Orion-Interest
>>>> > > > Subject: EJB Help..
>>>> > > >
>>>> > > >
>>>> > > > Hi all,
>>>> > > >
>>>> > > > I am trying my hand at EJB with Orion, and I am wondering if
>>>> > > > there is any
>>>> > > > way to avoid the hassle of always having to package the ejb
>>>> > > > classes into a
>>>> > > > .jar file, and so on. Is there any way at all to develop and
>>>> > > > deploy ejbs
>>>> > > > using an expanded dir structure, much like in the development
>>>> > > > of a .war
>>>> > > > file..where you have the whole www dir, WEB-INF, etc
>>>> > > > expanded..but then jar
>>>> > > > it up and rename it to .war for deployment? It seems rather
>>>> > > > tedious on ejb
>>>> > > > development every time a change is made, the whole thing has to
>>>> > > > be repackaged and deployed. I know there are some tools, such as
>>>> > > > JBuilder,
>>>> > > > VisualCafe, etc that do this for you somewhat nicely..but
>>>> > > > even those take a
>>>> > > > little bit of time to do it. So, for the purposes of
>>>> > > > development, where many
>>>> > > > changes are happening on any regular basis, how can I quickly
>>>> > > > develop and
>>>> > > > test ejb, with Orion, or any app server for that matter.
>>>> > I do want the
>>>> > > > ability for the context.lookup() call to work. The reason
>>>> > > > is..I have two
>>>> > > > computers, networked. I want to develop the ejbs on one
>>>> > > > computer, and have
>>>> > > > my www stuff on the other hitting them over the network so
>>>> > > > that i can get
>>>> > > > some kind of feel of the performance. I have a 4-way
>>>> > switch, so I can
>>>> > > > develop www stuff, then switch over to the other computer and
>>>> > > > do some ejb
>>>> > > > stuff. I will run one instance of Orion on each computer.
>>>> > > > However, I don't
>>>> > > > mind also being able to run www and ejb stuff in the same on
>>>> > > > instance on one
>>>> > > > computer, as long as the lookup stuff is used the same way,
>>>> > > > even though the
>>>> > > > ejb's are running locally.
>>>> > > >
>>>> > > > Any pointers on how to set up Orion to do this, including the
>>>> > > > application.xml <module> tag (how to point it to the right
>>>> > > > place instead of
>>>> > > > the ejb.jar file, for example so that the ejbs will get
>>>> > > > picked up by the
>>>> > > > server), web.xml, orion-web.xml, server.xml, etc..anything
>>>> > > > that needs to be
>>>> > > > done to get this to work.
>>>> > > >
>>>> > > > Thanks so much for any help.
>>>> > > >
>>>> > > >
>>>> > >
>>>> >
>>>>
>>>
>>
>>
>>
>>
>>
>>





Reply via email to