• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to add ejb 1.1* type where clause finders in ejb 2.0 beans using WSAD

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do I HAVE to use ejbql for the finders of my ejb 2.0 entity beans ?
Here is my problem. I am using ejb 2.0 and WSAD 5.0 as development environment.

1) I have a Department bean in the OrgEJB project.
2) I have User and UserDept beans in the UserEJB project
Note:- Department, User and UserDept are also database table names. The UserDept table maps users to departments.
I want to find out all departments of a given user.
i.e a finder off Department EJB(actually Home interface) called findByUserId(int userId)
The SQL I would use is:
SELECT * FROM department d WHERE d.dept_no IN (SELECT ud.dept_no FROM UserDept ud where ud.user_id = ?
WSAD allowed to define where clause finders in ejb 1.1*. The "finders" section in the Deployment descriptor gui enabled you to define only the where clause.
But in ejb 2.0 projects, the deployment descriptor gui only allows you to define EJBQL based finders.
My questions:
1) How do I write the above SQL command in EJBQL so that my finder can use it ?
2) If the solution is to use CMR, my beans are in different projects. How can I set up CMR between them.
Appreciate all the help I can get.
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You must place the EJBs into the same project. If that is not possible, then create another EJB that maps to the same table (yes, that is allowed and is fine) in one or the other project.
After that, you should be able to use EJB-QL. There is no other option in WebSphere 5.0.
Kyle
 
"To do good, you actually have to do something." -- Yvon Chouinard
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic