Thursday, July 16, 2015

Ormlite single quote issue solution

Correct way to implement com.j256.ormlite.stmt.Where<T, ID>:

you should use com.j256.ormlite.stmt.SelectArg object instead of using Object
SelectArg arg = new SelectArg();
titleArg.setValue(value);
Where<T, ID> where = where.eq(fieldName, arg);

Using this way you will avoid this issue http://stackoverflow.com/questions/26254896/android-ormlite-selectarg i.e. if  String value contains single quote.


No comments:

Post a Comment