Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ejb, help

 
Shreya Menon
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18167
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic