multithreading - Need to concern about thread safety in singleton spring bean -


hello sql query generation handler create query insert account record.as can see i've marked @service singleton spring bean.

i need consider thread safety in scenario.
should need synchronize getinsertsql menthod or lock acc (account object) getinsertsql. class object used through out application. im not sure need consider thread concurrency or not singleton spring bean .

 @service  public class accountsqlhandler implements sqlhandler {  private logger logger = logger.getlogger(accountsqlhandler.class);       @override public stringbuilder getinsertsql(daopojo t)         throws invaliddaoparameterexception {             account acc = (account) t;             stringbuilder sb = new stringbuilder();     sb.append(jdbcconstants.insert_into);     sb.append(jdbcconstants.tbl_account);     sb.append("(");     sb.append(tblaccount.accountnumber + ", ");     sb.append(tblaccount.currencyid + ", ");     sb.append(")");     sb.append(jdbcconstants.values);     sb.append("( ");     sb.append("'" + acc.getaccountnumber() + "'" + ", ");     sb.append(acc.getcurrencyid() + ", ");             sb.append(")");      return sb; 

}


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -