You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Aravinda Addala <ar...@majorband.co.uk> on 2001/04/12 17:53:38 UTC

Criteria.addIn() with TurbineSecurity.getUsers()

Hi,

I have problem with Criteria.addIn() method.
TurbineSecuity.getUsers(criteria) method is not working with
criteria.addIn() method.

The following piece of code doesn't work:


        criteria.addIn("LOGIN_NAME", vecLoginName); //vecLoginName contains
3 usernames
        criteria.addOrderByColumn("LOGIN_NAME");
        return TurbineSecurity.getUsers(criteria);

But it works fine with:

	  criteria.add("LOGIN_NAME", "aravinda");
        criteria.addOrderByColumn("LOGIN_NAME");
        return TurbineSecurity.getUsers(criteria);


Thanks,
Aravinda Addala
Consultant
aravinda_addala@majorband.co.uk
+44 (0)7765 893 073

Majorband
5-6 Argyll Street
Oxford Circus
London W1F 7TE
www.majorband.co.uk

DISCLAIMER
=========================================================================
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of
Majorband Ltd.

We have taken all reasonable measures to protect this email from viruses.
However, we cannot accept any liability arising from virus transmission
which results from your accessing any part of this message. The contents of
this message and all attachments have been sent in confidence for the
attention of the addressee only. If you are not the intended recipient you
are kindly requested to preserve this confidentiality and to advise the
sender immediately of the error in transmission.





---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Criteria.addIn() with TurbineSecurity.getUsers()

Posted by Aravinda Addala <ar...@majorband.co.uk>.
oops... the error generated by the log file is not very correct. The sql is
automatically generated by Criteria.addIn(). I think, there are some
problems with using addIn method with TurbineSecurity

-----Original Message-----
From: Sean Legassick [mailto:sean@informage.net]
Sent: 17 April 2001 16:37
To: turbine-user@jakarta.apache.org
Subject: Re: Criteria.addIn() with TurbineSecurity.getUsers()


In message
<LP...@majorband.co.uk>, Aravinda
Addala <ar...@majorband.co.uk> writes
>
>[Tue Apr 17 12:44:26 GMT+01:00 2001] -- ERROR -- Turbine.handleException:
>Failed to retrieve users: Syntax error or access violation: You have an
>error in your SQL syntax near '[aravinda, ghosh, craig])' at line 1

Yep, well something's gone wrong there - those names should be quoted,
and those should be parentheses not square brackets...

I'll take a look and see if I can see what's going on.

--
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Criteria.addIn() with TurbineSecurity.getUsers()

Posted by Sean Legassick <se...@informage.net>.
In message 
<LP...@majorband.co.uk>, Aravinda 
Addala <ar...@majorband.co.uk> writes
>
>[Tue Apr 17 12:44:26 GMT+01:00 2001] -- ERROR -- Turbine.handleException:
>Failed to retrieve users: Syntax error or access violation: You have an
>error in your SQL syntax near '[aravinda, ghosh, craig])' at line 1

Yep, well something's gone wrong there - those names should be quoted, 
and those should be parentheses not square brackets...

I'll take a look and see if I can see what's going on.

-- 
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Criteria.addIn() with TurbineSecurity.getUsers()

Posted by Aravinda Addala <ar...@majorband.co.uk>.
[Tue Apr 17 12:44:26 GMT+01:00 2001] -- ERROR -- Turbine.handleException:
Failed to retrieve users: Syntax error or access violation: You have an
error in your SQL syntax near '[aravinda, ghosh, craig])' at line 1
[Tue Apr 17 12:44:26 GMT+01:00 2001] -- ERROR --
	Exception:  org.apache.turbine.util.security.DataBackendException: Failed
to retrieve users: Syntax error or access violation: You have an error in
your SQL syntax near '[aravinda, ghosh, craig])' at line 1
	Stack Trace follows:
	java.sql.SQLException: Syntax error or access violation: You have an error
in your SQL syntax near '[aravinda, ghosh, craig])' at line 1
	at org.gjt.mm.mysql.MysqlIO.sendCommand(MysqlIO.java:497)
	at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(MysqlIO.java:550)
	at org.gjt.mm.mysql.MysqlIO.sqlQuery(MysqlIO.java:635)
	at org.gjt.mm.mysql.Connection.execSQL(Connection.java:882)
	at org.gjt.mm.mysql.Connection.execSQL(Connection.java:815)
	at org.gjt.mm.mysql.Statement.executeQuery(Statement.java:169)
	at org.gjt.mm.mysql.jdbc2.Statement.executeQuery(Statement.java:78)
	at com.workingdogs.village.QueryDataSet.<init>(QueryDataSet.java:112)
	at org.apache.turbine.om.peer.BasePeer.executeQuery(BasePeer.java:1252)
	at org.apache.turbine.om.peer.BasePeer.executeQuery(BasePeer.java:1215)
	at org.apache.turbine.om.peer.BasePeer.executeQuery(BasePeer.java:1166)
	at org.apache.turbine.om.peer.BasePeer.doSelect(BasePeer.java:1095)
	at
org.apache.turbine.om.security.peer.TurbineUserPeer.doSelect(TurbineUserPeer
.java:300)
	at
org.apache.turbine.om.security.peer.TurbineUserPeer.doSelect(TurbineUserPeer
.java:248)
	at
org.apache.turbine.services.security.db.DBUserManager.retrieve(DBUserManager
.java:209)
rethrown as org.apache.turbine.util.security.DataBackendException: Failed to
retrieve users: Syntax error or access violation: You have an error in your
SQL syntax near '[aravinda, ghosh, craig])' at line 1
	at
org.apache.turbine.services.security.db.DBUserManager.retrieve(DBUserManager
.java:213)
	at
org.apache.turbine.services.security.BaseSecurityService.getUsers(BaseSecuri
tyService.java:356)
	at
org.apache.turbine.services.security.TurbineSecurity.getUsers(TurbineSecurit
y.java:258)
	at
org.apache.turbine.flux.modules.screens.user.FluxUserList.getUsers(FluxUserL
ist.java:189)
	at
org.apache.turbine.flux.modules.screens.user.FluxUserList.doBuildTemplate(Fl
uxUserList.java:89)
	at
org.apache.turbine.flux.modules.screens.FluxScreen.doBuildTemplate(FluxScree
n.java:118)
	at
org.apache.turbine.modules.screens.TemplateScreen.doBuild(TemplateScreen.jav
a:135)
	at org.apache.turbine.modules.Screen.build(Screen.java:98)
	at org.apache.turbine.modules.ScreenLoader.eval(ScreenLoader.java:129)
	at
org.apache.turbine.modules.layouts.VelocityECSLayout.doBuild(VelocityECSLayo
ut.java:103)
	at org.apache.turbine.modules.Layout.build(Layout.java:91)
	at org.apache.turbine.modules.LayoutLoader.exec(LayoutLoader.java:122)
	at
org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:171)
	at org.apache.turbine.modules.Page.build(Page.java:90)
	at org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123)
	at org.apache.turbine.Turbine.doGet(Turbine.java:414)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:246)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:191)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:254)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:201)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:468)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2087)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:162)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
818)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
	at java.lang.Thread.run(Thread.java:484)

-----Original Message-----
From: Sean Legassick [mailto:sean@informage.net]
Sent: 17 April 2001 12:50
To: turbine-user@jakarta.apache.org
Subject: Re: Criteria.addIn() with TurbineSecurity.getUsers()


In message
<LP...@majorband.co.uk>, Aravinda
Addala <ar...@majorband.co.uk> writes
>
>This is the SQL generated by Criteria.toString()...

Oh - well that would look like that..

Only a log of the SQL actually being sent to the DB is useful.

And what is the problem you are getting? (i.e. what happens when you
call getUsers?)


--
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Criteria.addIn() with TurbineSecurity.getUsers()

Posted by Sean Legassick <se...@informage.net>.
In message 
<LP...@majorband.co.uk>, Aravinda 
Addala <ar...@majorband.co.uk> writes
>
>This is the SQL generated by Criteria.toString()...

Oh - well that would look like that..

Only a log of the SQL actually being sent to the DB is useful.

And what is the problem you are getting? (i.e. what happens when you 
call getUsers?)


-- 
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Criteria.addIn() with TurbineSecurity.getUsers()

Posted by Aravinda Addala <ar...@majorband.co.uk>.
This is the SQL generated by Criteria.toString()...

-----Original Message-----
From: Sean Legassick [mailto:sean@informage.net]
Sent: 17 April 2001 11:43
To: turbine-user@jakarta.apache.org
Subject: Re: Criteria.addIn() with TurbineSecurity.getUsers()


In message
<LP...@majorband.co.uk>, Aravinda
Addala <ar...@majorband.co.uk> writes
>
>The sql generated is: SELECT  FROM TURBINE_USER WHERE
>(TURBINE_USER.LOGIN_NAME IN ('aravinda','test','test2')) ORDER BY
>TURBINE_USER.LOGIN_NAME

Uh-huh. No SELECT columns in the query... well after a quick look at the
relevant code (DBUserManager.retrieve and TurbineUserPeer.doSelect) I
still can't see why this would happen.

When I get a chance I'll see if I can reproduce this... (unless anyone
else has any bright ideas about why the select columns aren't getting
added to the query).

--
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Criteria.addIn() with TurbineSecurity.getUsers()

Posted by Sean Legassick <se...@informage.net>.
In message 
<LP...@majorband.co.uk>, Aravinda 
Addala <ar...@majorband.co.uk> writes
>
>The sql generated is: SELECT  FROM TURBINE_USER WHERE
>(TURBINE_USER.LOGIN_NAME IN ('aravinda','test','test2')) ORDER BY
>TURBINE_USER.LOGIN_NAME

Uh-huh. No SELECT columns in the query... well after a quick look at the 
relevant code (DBUserManager.retrieve and TurbineUserPeer.doSelect) I 
still can't see why this would happen.

When I get a chance I'll see if I can reproduce this... (unless anyone 
else has any bright ideas about why the select columns aren't getting 
added to the query).

-- 
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Criteria.addIn() with TurbineSecurity.getUsers()

Posted by Aravinda Addala <ar...@majorband.co.uk>.
The sql generated is: SELECT  FROM TURBINE_USER WHERE
(TURBINE_USER.LOGIN_NAME IN ('aravinda','test','test2')) ORDER BY
TURBINE_USER.LOGIN_NAME



-----Original Message-----
From: Sean Legassick [mailto:sean@informage.net]
Sent: 17 April 2001 10:22
To: turbine-user@jakarta.apache.org
Subject: Re: Criteria.addIn() with TurbineSecurity.getUsers()


In message
<LP...@majorband.co.uk>, Aravinda
Addala <ar...@majorband.co.uk> writes
>Hi,
>
>I have problem with Criteria.addIn() method.
>TurbineSecuity.getUsers(criteria) method is not working with
>criteria.addIn() method.
>
>The following piece of code doesn't work:

Well after a quick glance over the relevant code, it looks to me like it
_should_ work (the criteria you pass in has each individual criterion
copied into a new criteria object, adding the table name to the column
key, but that shouldn't be a problem).

Can you give more details on "doesn't work". What is the generated SQL
query (recent builds allow logging of SQL queries through a switch in
TR.properties)

--
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Criteria.addIn() with TurbineSecurity.getUsers()

Posted by Sean Legassick <se...@informage.net>.
In message 
<LP...@majorband.co.uk>, Aravinda 
Addala <ar...@majorband.co.uk> writes
>Hi,
>
>I have problem with Criteria.addIn() method.
>TurbineSecuity.getUsers(criteria) method is not working with
>criteria.addIn() method.
>
>The following piece of code doesn't work:

Well after a quick glance over the relevant code, it looks to me like it 
_should_ work (the criteria you pass in has each individual criterion 
copied into a new criteria object, adding the table name to the column 
key, but that shouldn't be a problem).

Can you give more details on "doesn't work". What is the generated SQL 
query (recent builds allow logging of SQL queries through a switch in 
TR.properties)

-- 
Sean Legassick
sean@informage.net
         Je suis un homme: rien d'humain en m'est étranger

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org