Thought inc.

The Dynamic O/R Mapping Company
     

CocoBase Technical Support Forums
For access to developer site with software download and doc's, please request CocoBase download and password
will be emailed to you. Response to posts will appear when answered by THOUGHT Support team.
NOTE:You must register separately with forum in order to post your questions, please click on register icon below.
Home   Frequently Asked Questions   Search   Edit your profile   Registration is free!  
Email This Page to Someone!
Show a Printable Version
CocoBase Enterprise O/R Forums > CocoBase Questions
CBFacade - Problem with executeQLQuery method
< Previous Thread     Next Thread >
Author
Thread    Post New Thread     Post A Reply
JoselitoSoares
Member

Registered: Mar 2004
Posts: 15

...

String ql = "Select object(o) From com.mypkg.CorPais o Where o.paisCodigo like ?1 Order By o.paisCodigo";

Object[] params = {"B%"};

CBCursor cursor = cbf.executeQLQuery(ql, params, 100);
} catch (CBFacadeException e) {
...



The code above generates the following message error:



type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: [1,81] expecting: string
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
...

root cause

thought.CocoBase.EJBQLCompileException: [1,81] expecting: string
thought.CocoBase.EJBQLQuery.compile(EJBQLQuery.java:101)
thought.CocoBase.CBFacadeLocal.executeQLQuery(CBFacadeLocal.java:687)
thought.CocoBase.CBFacade.executeQLQuery(CBFacade.java:172)
..

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.7 logs.


What it is happening?

Regards.

Joselito Soares

03-17-2005 11:49 AM
Click Here to See the Profile for JoselitoSoares    Find more posts by JoselitoSoares        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

If we understand this correctly, the issue is that this part of
our compiler still is EJB 2.0, where LIKE expressions require a
"hardcoded" string constant (parameters are not allowed). To solve this you can try using the inline value 'B%', so a sample would look like:

String ql = "Select object(o) From com.mypkg.CorPais
o Where o.paisCodigo like 'B%' Order By o.paisCodigo";

CBCursor cursor = cbf.executeQLQuery(ql, 100);

to see if that runs. The latest EJB 2.1 spec supports these values dynamically, and we will be updating our EJBQL compiler to support those features in the near future.

THOUGHT Support

03-17-2005 12:27 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
JoselitoSoares
Member

Registered: Mar 2004
Posts: 15

1)I tried and It did not return error nor records.

2)I tried:

String ql = "Select object(o) From com.mypkg.CorPais o Where o.paisCodigo = ?1 Order By o.paisCodigo";

Object[] params = {"USA"};

CBCursor cursor = cbf.executeQLQuery(ql, params, 101);

It did not return error nor records.

Some suggestion?

Thanks

Joselito Soares

03-17-2005 02:01 PM
Click Here to See the Profile for JoselitoSoares    Find more posts by JoselitoSoares        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

You might enable debug to see what SQL is generated and email the result log file to our support account. If you have no exception, this might be a data issue.

THOUGHT Support

03-17-2005 02:20 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
JoselitoSoares
Member

Registered: Mar 2004
Posts: 15

Excuse me. I committed an error. The yours suggestion works well.

Thank you.

Joselito Soares

03-23-2005 06:59 AM
Click Here to See the Profile for JoselitoSoares    Find more posts by JoselitoSoares        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

Oh, glad to hear it!

THOUGHT Support

03-23-2005 11:55 AM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
fsilva
Member

Registered: Mar 2004
Posts: 18

Hi,

I'm trying to execute the following query, and I'm having some problems.
...
sql = new StringBuffer();
sql.append("select object (o) from br.com.synchro.sfisc.db.SynUsuario o ");
sql.append("where o.dhInclusao > 01/01/2004 ");
cbf = CBFacadeSyn.getInstance().getCBFacadeInstance();
param = new Vector();
Vector v = cbf.executeQLQuery(sql.toString(), param);

This code results in the following error:

thought.CocoBase.EJBQLCompileException: [1,69] - Type of map field 'DH_INCLUSAO' is not compatible with NUMERIC
thought.CocoBase.EJBQLQuery.compile(EJBQLQuery.java:105)
thought.CocoBase.CBFacadeLocal.executeQLQuery(CBFacadeLocal.java:600)
br.com.synchro.sfisc.security.Login.authenticate(Login.java:161)
br.com.synchro.security.AuthenticateFilter.doLogin(AuthenticateFilter.java:148)
br.com.synchro.security.AuthenticateFilter.doFilter(AuthenticateFilter.java:97)

If a I put the date between '', the error changes to:
thought.CocoBase.EJBQLCompileException: [1,69] - Type of map field 'DH_INCLUSAO' is not compatible with STRING

The field DH_INCLUSAO is a Timestamp in my Map.

Wath is wrong whit this code?? There's some limitation in EJB Compiler??

Thanks
Fernando Cesar.

06-03-2005 11:27 AM
Click Here to See the Profile for fsilva    Find more posts by fsilva        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

Hi,

Date and Time constants are not allowed in EJB-QL 2.0, which is what is currently support. You need to use a parameter to bind your Date object to the query expression, like this:

"where o.dhInclusao > ?1"

and then provide a Timestamp object for parameter ?1.

Hope that helps!
THOUGHT Support

06-03-2005 12:02 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
All times are PST (US)    Post New Thread     Post A Reply
Forum Jump:
< Previous Thread     Next Thread >

Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author. Messages can be deleted by their author.
Posts: HTML code is OFF. Smilies are OFF. vB code is OFF. [IMG] code is OFF.

Admin Options:
Open / Close Thread
Move Thread
Delete Thread
Edit Thread

< Contact Us - THOUGHT Inc. >

Copyright © Jelsoft Enterprises Limited 2000.
Copyright 2001 All Rights Reserved, THOUGHT Inc.