-
1. Re: findByDynamicQL
vincentchun Sep 29, 2003 6:10 AM (in response to mikala)Are you use CMP?
or findByDynamicQL is a BMP method?
if use CMP, do the following.
in your ejb-jar.xml, set the ejb-ql like this
<ejb-ql><![CDATA[SELECT OBJECT(o) FROM Grupy o WHERE o.nazwa= ?1]]></ejb-ql>
The query is not defined in your program.
set your jboss.xml & jbosscmp-jdbc.xml
"When I call findByDynamicQL first time it returns some objects (EJB)"
What are those objects? -
2. Re: findByDynamicQL
mikala Sep 29, 2003 7:22 AM (in response to mikala)I'm use CMP.
I prepare (define) QL in my program !!!
1 working example:
////////////////////////
q="select object(o) from tabe where o.x=?1 and o.y=?2";
arg={new String("polish string"),new String("polish string")};
findByDynamicQL(q,arg);
////////////////////////
2 not working example:
////////////////////////
q="select object(o) from tabe where o.x='polish string' and o.y='polish string'";
arg={};
findByDynamicQL(q,arg);
/////////////////////////
In my jbosscmp-jdbc.xml I have:
<query-method>
<method-name>findByDynamicQL</method-name>
<method-params>
<method-param>java.lang.String</method-param>
<method-param>java.lang.Object[]</method-param>
</method-params>
</query-method>
<dynamic-ql/>
When I'm looking in database log from first example I see correct SQL.
When I'm looking in db log from second example I see sql translated to iso-8859-1 charset and db don't find records. -
3. Re: findByDynamicQL
manuelf Sep 29, 2003 5:37 PM (in response to mikala)Hi mikala,
turn on trace for the cmp-engine and take a look at the generated sql-string it is sending to the database - maybe this shows you what's going on.
To turn on look at your servers log4j.xml - there you see some exampels for enabling tracing of jboss internal classes.
You have to enable tracing for org.jboss.ejb.plugins.cmp
cheers,
Manuel