Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-11-04 Thread Abimaran Kugathasan
Hi Ruwan, We used to keep the queries withing the method up to API Manager 1.9.1 [1], with vendor specific queries and the indentation of the queries took much space. So we moved the queries to a separate constant class for each vendor from API Manager 1.10 onwards [2] So having vendor specific

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-11-04 Thread Maduranga Siriwardena
On Fri, Nov 4, 2016 at 11:01 AM, Lahiru Cooray wrote: > > > On Thu, Nov 3, 2016 at 10:57 AM, Maduranga Siriwardena > wrote: > >> Hi Ruwan, >> >> Having the SQL query in the method itself improves the readability. >> >> However in C4 usercore and C5 user

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-11-04 Thread Lahiru Cooray
On Fri, Nov 4, 2016 at 11:30 AM, Maduranga Siriwardena wrote: > > > On Fri, Nov 4, 2016 at 11:01 AM, Lahiru Cooray wrote: > >> >> >> On Thu, Nov 3, 2016 at 10:57 AM, Maduranga Siriwardena < >> madura...@wso2.com> wrote: >> >>> Hi Ruwan, >>> >>> Having the

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-11-03 Thread Lahiru Cooray
On Thu, Nov 3, 2016 at 10:57 AM, Maduranga Siriwardena wrote: > Hi Ruwan, > > Having the SQL query in the method itself improves the readability. > > However in C4 usercore and C5 user store connector current implementation, > we have the SQL queries in a central place and

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-11-02 Thread Maduranga Siriwardena
Hi Ruwan, Having the SQL query in the method itself improves the readability. However in C4 usercore and C5 user store connector current implementation, we have the SQL queries in a central place and load it to a map at the time of the initialization of connector. With this approach one of the

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-11-01 Thread Ruwan Abeykoon
Hi Rajith, +1 final String insertIdpSql On Tue, Nov 1, 2016 at 11:33 AM, Rajith Roshan wrote: > Hi Ruwan, > > Since the final variable is not static can we name it using camel case > convention[1]. Otherwise check style plugin will give errors. > > [1] - final String

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-11-01 Thread Rajith Roshan
Hi Ruwan, Since the final variable is not static can we name it using camel case convention[1]. Otherwise check style plugin will give errors. [1] - final String insertIdpSql Thanks! Rajith On Fri, Oct 28, 2016 at 9:41 AM, Afkham Azeez wrote: > Query should be close to the

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-10-28 Thread Afkham Azeez
Query should be close to the code. +1 for Ruwan's proposal. Not only for queries, you should use your judgment when deciding where to place constants as well. In many cases, it makes sense to keep the constants in the relevant class where it is used but people have been blindly putting those into

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-10-27 Thread Selvaratnam Uthaiyashankar
Do we have any requirements to see all queries together? If so, defining in a single place would be easy. However, I am not sure whether we have used that requirement ever. We normally look at the query local to the method? If so, I am +1 for Ruwan's proposal. Being local constant to the method

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-10-27 Thread Sumedha Rubasinghe
I am actually in favour of what Ruwan is suggesting. 1. When a problem comes we usually start by looking at the particular query. There is no need to look at all queries together. 2. Having the query close to rest of the jdbc code is easier. 3. Regardless of where it is, all queries should be

Re: [Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-10-27 Thread Sagara Gunathunga
Personally I don't have strong preference on one style over other, what mostly important for me is maintain one style consistently within the product and if possible across the company. I'm adding few other people for their opinion. Thanks ! On Thu, Oct 27, 2016 at 5:34 PM, Ruwan Abeykoon

[Dev] Shall we change the convention for placement of DB Query String in Java Code.

2016-10-27 Thread Ruwan Abeykoon
Hi Devs, We have been following a convention to put Database query string in a constant elsewhere in the code when performing DB CRUD operations. e.g. try { String sqlStmt = IdPManagementConstants.SQLQueries.GET_IDP_BY_NAME_SQL; prepStmt = dbConnection.prepareStatement(sqlStmt);