Buggy code:
public class GroupManagerDao { private Database db ; protected NameLayerPlugin plugin = NameLayerPlugin . getInstance ( ) ; public GroupManagerDao ( Database db ) { } public void checkUpdate ( ) { } public void initializeProcedures ( ) { } private PreparedStatement version ; private PreparedStatement updateVersion ; private PreparedStatement createGroup ; private PreparedStatement getGroup ; private PreparedStatement getAllGroupsNames ; private PreparedStatement deleteGroup ; private PreparedStatement addMember ; private PreparedStatement getMembers ; private PreparedStatement removeMember ; private PreparedStatement updatePassword ; private PreparedStatement addSubGroup ; private PreparedStatement getSubGroups ; private PreparedStatement getSuperGroup ; private PreparedStatement removeSubGroup ; private PreparedStatement addPerm ; private PreparedStatement getPerms ; private PreparedStatement updatePerm ; private PreparedStatement mergeGroup ; private PreparedStatement countGroups ; private PreparedStatement addAutoAcceptGroup ; private PreparedStatement getAutoAcceptGroup ; private PreparedStatement removeAutoAcceptGroup ; public void initializeStatements ( ) { version = db . prepareStatement ( "select<seq2seq4repair_space>max(db_version)<seq2seq4repair_space>as<seq2seq4repair_space>db_version<seq2seq4repair_space>from<seq2seq4repair_space>db_version<seq2seq4repair_space>where<seq2seq4repair_space>plugin_name=?" ) ; updateVersion = db . prepareStatement ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>db_version<seq2seq4repair_space>(db_version,<seq2seq4repair_space>update_time,<seq2seq4repair_space>plugin_name)<seq2seq4repair_space>values<seq2seq4repair_space>(?,?,?)" ) ; createGroup = db . prepareStatement ( "call<seq2seq4repair_space>createGroup(?,?,?,?,?)" ) ; getGroup = db . prepareStatement ( ( "select<seq2seq4repair_space>group_name,<seq2seq4repair_space>founder,<seq2seq4repair_space>password,<seq2seq4repair_space>discipline_flags,<seq2seq4repair_space>group_type<seq2seq4repair_space>" + "from<seq2seq4repair_space>faction<seq2seq4repair_space>where<seq2seq4repair_space>group_name<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ; getAllGroupsNames = db . prepareStatement ( ( "select<seq2seq4repair_space>f.group_name<seq2seq4repair_space>from<seq2seq4repair_space>faction_id<seq2seq4repair_space>f<seq2seq4repair_space>" + ( "inner<seq2seq4repair_space>join<seq2seq4repair_space>faction_member<seq2seq4repair_space>fm<seq2seq4repair_space>on<seq2seq4repair_space>f.group_id<seq2seq4repair_space>=<seq2seq4repair_space>fm.group_id<seq2seq4repair_space>" + "where<seq2seq4repair_space>fm.member_name<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ) ; deleteGroup = db . prepareStatement ( "call<seq2seq4repair_space>deletegroupfromtable(?,<seq2seq4repair_space>?)" ) ; addMember = db . prepareStatement ( ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>faction_member(" + ( "group_id,<seq2seq4repair_space>member_name,<seq2seq4repair_space>role)<seq2seq4repair_space>select<seq2seq4repair_space>group_id,<seq2seq4repair_space>?,<seq2seq4repair_space>?<seq2seq4repair_space>from<seq2seq4repair_space>" + "faction_id<seq2seq4repair_space>where<seq2seq4repair_space>group_name<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ) ; getMembers = db . prepareStatement ( ( "select<seq2seq4repair_space>fm.member_name<seq2seq4repair_space>from<seq2seq4repair_space>faction_member<seq2seq4repair_space>fm<seq2seq4repair_space>" + ( "inner<seq2seq4repair_space>join<seq2seq4repair_space>faction_id<seq2seq4repair_space>id<seq2seq4repair_space>on<seq2seq4repair_space>id.group_name<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" + "where<seq2seq4repair_space>fm.group_id<seq2seq4repair_space>=<seq2seq4repair_space>id.group_id<seq2seq4repair_space>and<seq2seq4repair_space>fm.role<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ) ; removeMember = db . prepareStatement ( ( "delete<seq2seq4repair_space>fm.*<seq2seq4repair_space>from<seq2seq4repair_space>faction_member<seq2seq4repair_space>fm<seq2seq4repair_space>" + ( "inner<seq2seq4repair_space>join<seq2seq4repair_space>faction_id<seq2seq4repair_space>fi<seq2seq4repair_space>on<seq2seq4repair_space>fi.group_name<seq2seq4repair_space>=<seq2seq4repair_space>?" + "where<seq2seq4repair_space>fm.group_id<seq2seq4repair_space>=<seq2seq4repair_space>fi.group_id<seq2seq4repair_space>and<seq2seq4repair_space>fm.member_name<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ) ; addSubGroup = db . prepareStatement ( ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>subgroup<seq2seq4repair_space>(group_id,<seq2seq4repair_space>sub_group_id)<seq2seq4repair_space>" + ( ( "select<seq2seq4repair_space>g.group_id,<seq2seq4repair_space>sg.group_id<seq2seq4repair_space>from<seq2seq4repair_space>faction_id<seq2seq4repair_space>g<seq2seq4repair_space>" + "inner<seq2seq4repair_space>join<seq2seq4repair_space>faction_id<seq2seq4repair_space>sg<seq2seq4repair_space>on<seq2seq4repair_space>sg.group_name<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" ) + "where<seq2seq4repair_space>g.group_name<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ) ; getSubGroups = db . prepareStatement ( ( "select<seq2seq4repair_space>f.group_name<seq2seq4repair_space>from<seq2seq4repair_space>faction_id<seq2seq4repair_space>f<seq2seq4repair_space>" + ( ( "inner<seq2seq4repair_space>join<seq2seq4repair_space>faction_id<seq2seq4repair_space>sf<seq2seq4repair_space>on<seq2seq4repair_space>sf.group_name<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" + "inner<seq2seq4repair_space>join<seq2seq4repair_space>subgroup<seq2seq4repair_space>sg<seq2seq4repair_space>on<seq2seq4repair_space>sg.group_id<seq2seq4repair_space>=<seq2seq4repair_space>sf.group_id<seq2seq4repair_space>" ) + "where<seq2seq4repair_space>f.group_id<seq2seq4repair_space>=<seq2seq4repair_space>sg.sub_group_id" ) ) ) ; getSuperGroup = db . prepareStatement ( ( "select<seq2seq4repair_space>f.group_name<seq2seq4repair_space>from<seq2seq4repair_space>faction_id<seq2seq4repair_space>f<seq2seq4repair_space>" + ( ( "inner<seq2seq4repair_space>join<seq2seq4repair_space>faction_id<seq2seq4repair_space>sf<seq2seq4repair_space>on<seq2seq4repair_space>sf.group_name<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" + "inner<seq2seq4repair_space>join<seq2seq4repair_space>subgroup<seq2seq4repair_space>sg<seq2seq4repair_space>on<seq2seq4repair_space>sg.sub_group_id<seq2seq4repair_space>=<seq2seq4repair_space>sf.group_id<seq2seq4repair_space>" ) + "where<seq2seq4repair_space>f.group_id<seq2seq4repair_space>=<seq2seq4repair_space>sg.group_id" ) ) ) ; removeSubGroup = db . prepareStatement ( ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>subgroup<seq2seq4repair_space>" + ( "where<seq2seq4repair_space>group_id<seq2seq4repair_space>=<seq2seq4repair_space>(select<seq2seq4repair_space>group_id<seq2seq4repair_space>from<seq2seq4repair_space>faction_id<seq2seq4repair_space>where<seq2seq4repair_space>group_name<seq2seq4repair_space>=<seq2seq4repair_space>?)" + "<seq2seq4repair_space>and<seq2seq4repair_space>sub_group_id<seq2seq4repair_space>=<seq2seq4repair_space>(select<seq2seq4repair_space>group_id<seq2seq4repair_space>from<seq2seq4repair_space>faction_id<seq2seq4repair_space>where<seq2seq4repair_space>group_name<seq2seq4repair_space>=<seq2seq4repair_space>?)" ) ) ) ; addPerm = db . prepareStatement ( ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>permissions<seq2seq4repair_space>(group_id,<seq2seq4repair_space>role,<seq2seq4repair_space>tier)<seq2seq4repair_space>" + "select<seq2seq4repair_space>g.group_id,<seq2seq4repair_space>?,<seq2seq4repair_space>?<seq2seq4repair_space>from<seq2seq4repair_space>faction_id<seq2seq4repair_space>g<seq2seq4repair_space>where<seq2seq4repair_space>g.group_name<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ; getPerms = db . prepareStatement ( ( "select<seq2seq4repair_space>p.role,<seq2seq4repair_space>p.tier<seq2seq4repair_space>from<seq2seq4repair_space>permissions<seq2seq4repair_space>p<seq2seq4repair_space>" + ( "inner<seq2seq4repair_space>join<seq2seq4repair_space>faction_id<seq2seq4repair_space>fi<seq2seq4repair_space>on<seq2seq4repair_space>fi.group_name<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" + "where<seq2seq4repair_space>p.group_id<seq2seq4repair_space>=<seq2seq4repair_space>fi.group_id" ) ) ) ; updatePerm = db . prepareStatement ( ( "update<seq2seq4repair_space>permissions<seq2seq4repair_space>p<seq2seq4repair_space>set<seq2seq4repair_space>p.tier<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" + "where<seq2seq4repair_space>p.group_id<seq2seq4repair_space>=<seq2seq4repair_space>(select<seq2seq4repair_space>g.group_id<seq2seq4repair_space>from<seq2seq4repair_space>faction_id<seq2seq4repair_space>g<seq2seq4repair_space>where<seq2seq4repair_space>g.group_name<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>limit<seq2seq4repair_space>1)<seq2seq4repair_space>and<seq2seq4repair_space>p.role<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ; countGroups = db . prepareStatement ( "select<seq2seq4repair_space>count(*)<seq2seq4repair_space>as<seq2seq4repair_space>count<seq2seq4repair_space>from<seq2seq4repair_space>faction" ) ; mergeGroup = db . prepareStatement ( "call<seq2seq4repair_space>mergeintogroup(?,?)" ) ; updatePassword = db . prepareStatement ( ( "update<seq2seq4repair_space>faction<seq2seq4repair_space>set<seq2seq4repair_space>`password`<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" + "where<seq2seq4repair_space>group_name<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ; addAutoAcceptGroup = db . prepareStatement ( ( "insert<seq2seq4repair_space>into<seq2seq4repair_space>toggleAutoAccept(uuid)" + "values(?)" ) ) ; <START_BUG> getAutoAcceptGroup = db . prepareStatement ( ( "select<seq2seq4repair_space>count(*)<seq2seq4repair_space>from<seq2seq4repair_space>toggleAutoAccept<seq2seq4repair_space>" + "where<seq2seq4repair_space>uuid<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ; <END_BUG> removeAutoAcceptGroup = db . prepareStatement ( "delete<seq2seq4repair_space>from<seq2seq4repair_space>toggleAutoAccept<seq2seq4repair_space>where<seq2seq4repair_space>uuid<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ; } public int checkVersion ( String name ) { } public int updateVersion ( int version , String pluginname ) { } public void createGroup ( String group , UUID owner , String password , GroupType type ) { } public Group getGroup ( String groupName ) { } public List < String > getGroupNames ( UUID uuid ) { } public void deleteGroup ( String groupName ) { } public void addMember ( UUID member , String faction , PlayerType role ) { } public List < UUID > getAllMembers ( String groupName , PlayerType role ) { } public void removeMember ( UUID member , String group ) { } public void addSubGroup ( String group , String subGroup ) { } public List < Group > getSubGroups ( String group ) { } public Group getSuperGroup ( String subGroup ) { } public void removeSubGroup ( String group , String subGroup ) { } public void addPermission ( String groupName , String role , String values ) { } public Map < PlayerType , List < PermissionType > > getPermissions ( String group ) { } public void updatePermissions ( String group , PlayerType pType , String perms ) { } public int countGroups ( ) { } public void mergeGroup ( String groupName , String toMerge ) { } public void updatePassword ( String groupName , String password ) { } public void autoAcceptGroups ( UUID uuid ) { } public boolean shouldAutoAcceptGroups ( UUID uuid ) { } public void removeAutoAcceptGroup ( UUID uuid ) { } No newline ; at end ; of file ; }

Fix:
getAutoAcceptGroup = db . prepareStatement ( ( "select<seq2seq4repair_space>uuid<seq2seq4repair_space>from<seq2seq4repair_space>toggleAutoAccept<seq2seq4repair_space>" + "where<seq2seq4repair_space>uuid<seq2seq4repair_space>=<seq2seq4repair_space>?" ) ) ;