aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Ejb, help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Ejb, help" Watch "Ejb, help" New topic
Author

Ejb, help

Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Hi,
Let me explain what am I try to do with EJBs here.
I have to get 3 values from 2 tables,
SAY PRODUCT TABLE AND CUSTOMER TABLE (AS AN EXAMPLE)
Customer table has 2 fields, Customer_ID( Primary key) and CustName
PRODUCT TABLE has three fields, ProductName, Desc and CustID(which is a foreign key)[This table doesnt have a PK]
I am getting productname, desc and custName from the two tables where CustID is the same.
So, this can be done with the simple SQL statement.
select b.PRODUCTNAME, B.DESC, A.CUST_LISTED_NAME FROM PRODUCTS B, CUSTOMER A
WHERE
A.CUSTOMER_ID = '11111'
Now I want to create two EJBs and select this custName, or findByCustID
How do I approach this situation. Which is the best way ?
Any suggestions are welcome
Thanks,
Maya
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16140
    
  21

Sigh. I DO so hate "best". It oversimplifies. There's no such thing as a "best" sort algorithm, only "best" for the data at hand and the environment you're running in. Run a heapsort on nearly ordered data against a bubble sort and tell which is "best".
Same for J2EE. About the only "best" I can give you is that if you want to treat 2 tables as a unit, then control them with a unitary object. This can be a Session EJB, a servlet helper class, or, if you're into Struts, an Action helper. I might choose any of the above or something completely different depending on the requirements of the project and what framework I was using.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ejb, help