• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Finder methods in WebSphere 4.0

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Jacqueline Qin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic