Hi all. I am wondering if anyone can give me some pointers on using EJB QL in WebSphere. I understand that WebSphere currently support only 1.1 but it supposedly also support EJB QL in the ibm-ejb-jar-ext.xmi file. I try adding my own finder descriptor text as follow :
finderDescriptors xsi:type="ejbext:EjbqlFinderDescriptor" mi:id="findbyowner" ejbqlQueryString="SELECT OBJECT(o) FROM MYTABLE AS o WHERE (o.userID = ?1) AND (o.NAME = ?2)" finderMethodElements xmi:id="MethodElement_2" name="findByOwnerIDandType" parms="java.lang.Long java.lang.Integer " type="Home"
I also have this two methods in my home interface. But this doesn't seems to work. So I used the the "where clause" via the AAT, which only work if I use "long" instead of "java.lang.Long". If I use "java.lang.Long", it will give me a SQLPreparedStatement "setLong" error. What I don't understand is, in my previous declaration of java.lang.Long, WebSphere is smart enuff to add a longValue() to my java.lang.Long variable in the setLong methods. Can anyone help on this?
My advice is do not try to use the EJBQL. The EJBQL in WAS 4.0 is NOT standard EJBQL -- it's a subset (but not a proper subset -- there's some odd bits added in). Instead, use SQL. Your life will be much easier. Kyle
Thanks for the tip. Ok, so I tried with FullSelectFinderDescriptor using the selectStatement="SELECT T1.USERID FROM T1.MYTABLE". Hmm.... I noticed one thing. In the Inforcenter, it mentioned it supported 4 custom finders which includes SQL SELECT, SQL WHERE, SQL Method, EJB query language. However in AAT, only the SQL Where (whereClause) option is available to help you generate the finder descriptor codes in the ibm-ejb-jar-ext.xmi. Does that means if I want to use the other methods, I have select the user option, jar the file (save it) and modify the generated ibm-ejb-jar-ext.xmi file, right? I try that but it keep throwing a "Must implement Method in Bean class". I am wondering if I need to implement a finder helper interface for the SQL SELECT, SQL Method, and EJB query? I mean SQL Where is the only working one now without a finder helper. Can anyone verify what I have just written? Or give me the correct step of using the find methods without using finder helper interface.