Hi Cory,
Perhaps I can help a little...
With CMP it is largely up to the server (orion) to decide how it will store
its data. Books will generally not discuss the details of the storage
precisely because it is up to the server vendor to decide. If you need
complete control over the storage scheme, use BMP, not CMP.
That said, it may still be quite possible for you to use CMP.
In your example it looks like your two tables contain (id, first_name,
job_id) and (job_id, job_description). Now, suppose you created two entity
beans:
- one called Job which has a primary key of job_id and a String field of
job_description
- one called Person which has a primary key of id, a String field of
first_name, and a Job field of job_id.
If you did this you would find that Orion would auto-create tables that are
basically identical in form to those that you have, but probably with
different names. If you now go into the orion-ejb.xml file that orion
generates you can change the table and column names to those that you
already have. When you have done this, you have the two tables linked
transparently by Orion. Just asking for a Person will automatically
retrieve the Job, and from that you can retrieve the job_description.
I've skimmed a few details, but if you've played with Orion a bit I think
you should be able to get it to work. Also, although what I have told you
will work, I will not make any claims about this being the BEST solution
for you!
Nick
At 05:47 PM 9/11/00 -0400, you wrote:
>If I have two tables and I would like to join them using CMP how would I
>accomplish that?
>
>So in essence I'm trying to do something like:
>
>select table1.id, table1.first_name, table1.job_id, table2.job_description
>from table1, tables2
>where table1.job_id = table2.job_id;
>
>And perhaps any description on how to do the OR mapping for EJB. I have
>all of the books and can not seem to find the detail that I need to do CMP.
>
>Thanks,
>
>Cory
>
>At 03:55 PM 9/11/00 +0100, Joe Walnes wrote:
>>> Can somebody please point me to a good reference for managing
>>> joins across
>>> multiple tables while using CMP? There was a thread on the list that
>>> somebody pointed me to previously but it did not really give the
>>> information I needed.
>>>
>>> I just want to be able to specify tables and fields to do joins on with
>>> Orion for CMP.
>>
>>If you could go into a bit more detail about the problem, I'm sure someone
>>could help you out.
>>
>>This might be what you're after:
>>http://www.orionsupport.com/complex-or.html
>>
>>-Joe Walnes
>>
>>
>>