I found a way to make a generic query using JOnAS CMP bean, but it's a hack
into the xml descriptor

let's say your dynamic query is
  select a.lname from employees a, managers b where a.ssn = b.ssn and
b.level = 10
and your employees table looks like
  fname, lname, ssn, ..., where the primary key is ssn

you can modify your jonas-ejb-jar.xml and add a finder function and the
where clause
  <jdbc-where-clause>
  where 1=2 union select a.ssn from employees a, managers b where a.ssn =
b.ssn and b.level = ?
  </jdbc-where-clause>

  the first query should return nothing, and the real query comes after the
union. For JOnAS CMP bean, the primary keys are selected, so you have to
select ssn and then get the name from the employees entity bean

and your finder function in the home interface could be
  Enumeration findByManagerLeve(Integer level);

when you compile your code and use GenIC, use -keepgenerated and you will
see how this query worked into the actual home finder function


----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to