Hi,
I am having an issue with castor where it is doing a select on a table and
retrieves a field in the where clause that contains a ? (Question Mark). It
seems that it is trying a variable substitution or something that is causing
it to think the question mark in my query is something it is not. I have
included what my debug says the sqlExpr is set to, the method in question,
and the error below. Has anyone experienced this ...know any workarounds or
fixes?
Thanks,
-Jon Borgman
----------------------------------------------------------------------------
-------------
sqlExpr = "SYN_USER_PROFILE"."USERNAME" = 'testert' AND
"SYN_USER_PROFILE"."PASSWORD" = 'testerT?'
----------------------------------------------------------------------------
-------------
private void addWhereClause(ParseTreeNode whereClause) {
String sqlExpr = getSQLExpr(whereClause.getChild(0));
//Map numbered parameters
StringBuffer sb = new StringBuffer();
int startPos = 0;
int pos = sqlExpr.indexOf("?", startPos);
int SQLParamIndex = 1;
while ( pos != -1 ) {
int endPos = sqlExpr.indexOf(" ", pos);
Integer paramNumber = null;
if ( endPos != -1 )
paramNumber = new Integer(sqlExpr.substring(pos + 1, endPos));
else
paramNumber = new Integer(sqlExpr.substring(pos + 1));
ParamInfo paramInfo = (ParamInfo) _paramInfo.get(paramNumber);
paramInfo.mapToSQLParam( SQLParamIndex++ );
sb.append( sqlExpr.substring( startPos, pos+1 ) );
startPos = endPos < 0 ? sqlExpr.length() : endPos;
pos = sqlExpr.indexOf("?", startPos);
}
if ( startPos < sqlExpr.length() )
sb.append( sqlExpr.substring( startPos ) );
_queryExpr.addWhereClause( sb.toString() );
_SQLParamIndex = SQLParamIndex; //Alex
}
----------------------------------------------------------------------------
----
java.lang.NumberFormatException: '
at java.lang.Integer.parseInt(Integer.java:409)
at java.lang.Integer.<init>(Integer.java:544)
at
org.exolab.castor.jdo.oql.ParseTreeWalker.addWhereClause(ParseTreeWalker.jav
a:1052)
at
org.exolab.castor.jdo.oql.ParseTreeWalker.createQueryExpression(ParseTreeWal
ker.java:862)
at
org.exolab.castor.jdo.oql.ParseTreeWalker.<init>(ParseTreeWalker.java:138)
at
org.exolab.castor.jdo.engine.OQLQueryImpl.create(OQLQueryImpl.java:275)
at
org.exolab.castor.jdo.engine.DatabaseImpl.getOQLQuery(DatabaseImpl.java:467)
at
com.thomson.trainer.model.PersisterNontransactional.getObjectFromQuery(Persi
sterNontransactional.java:384)
at
com.thomson.trainer.model.PersisterTransactional.getObjectFromQuery(Persiste
rTransactional.java:153)
at
com.thomson.trainer.model.PersisterTransactional.getRowFromQuery(PersisterTr
ansactional.java:138)
at
com.thomson.trainer.model.dao.UserSlaveDaoImpl.getUserProfile(UserSlaveDaoIm
pl.java:100)
at
com.thomson.trainer.model.dao.UserDaoImpl.getUserProfile(UserDaoImpl.java:29
9)
at
com.thomson.trainer.business.user.UserManagerImpl.login(UserManagerImpl.java
:77)
at
com.thomson.trainer.web.action.LoginAction.executeAction(LoginAction.java:48
)
at
com.thomson.trainer.web.action.BaseAction.execute(BaseAction.java:40)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:480)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
com.iplanet.server.http.servlet.WFilterChain.doFilter(WFilterChain.java:144)
at
com.thomson.trainer.web.servlet.filter.AuthFilter.doFilter(AuthFilter.java:8
5)
at
com.iplanet.server.http.servlet.WFilterChain.doFilter(WFilterChain.java:130)
at
com.thomson.trainer.web.servlet.filter.TimerFilter.doFilter(TimerFilter.java
:59)
at
com.iplanet.server.http.servlet.WFilterChain.doFilter(WFilterChain.java:130)
at
com.thomson.trainer.web.servlet.filter.LoggerFilter.doFilter(LoggerFilter.ja
va:75)
at
com.iplanet.server.http.servlet.WebApplication.serviceServletFilters(WebAppl
ication.java:1105)
at
com.iplanet.server.http.servlet.WebApplication.service(WebApplication.java:1
063)
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev