-
1. Re: Results missing in ejb-ql in jboss 3.2.3
sesques May 19, 2004 12:39 PM (in response to jofli)Hi,
I think that you cannot use CMR fields for this query. Using CMR fields force the container to join the tables, so the null values are omitted.
In fact, testing null values on foreign keys is similar to testing values on CMP fields.
I think you have 2 major solutions:
1) Add CMP fields for all the foreign keys (choose a different name from the corresponding CMR) and test the null value on the CMP fields.
2) Try to override the EJB-QL mapping with a DeclareSQL statement (I never test it but it is designed to desperate hopeless.
Pascal -
2. Re: Results missing in ejb-ql in jboss 3.2.3
jofli May 21, 2004 2:36 AM (in response to jofli)Thank you for your reply. It actually works with declaredSQL like this:
* @jboss.declared-sql
* signature = "java.util.Collection findByInheritance(int productId, int sectionId, int articleTypeId, int articlePartId)"
* alias = "abl"
* where = "abl.product_id = {0} AND
* (abl.section_id IS NULL OR abl.section_id = {1}) AND
* (abl.article_type_id IS NULL OR abl.article_type_id = {2}) AND
* (abl.article_part_id IS NULL OR abl.article_part_id = {3})"