Buggy code:
@ RegisterMapper ( OrganizationMapper . class ) public interface OrganizationDAO { @ SqlQuery ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>Organization" ) public List < Organization > findOrganizations ( ) { } <START_BUG> @ SqlQuery ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>Organization<seq2seq4repair_space>org,<seq2seq4repair_space>User<seq2seq4repair_space>user,<seq2seq4repair_space>UserOrganization<seq2seq4repair_space>userOrg<seq2seq4repair_space>" + ( ( "WHERE<seq2seq4repair_space>userOrg.UserID<seq2seq4repair_space>=<seq2seq4repair_space>userOrg.UserID<seq2seq4repair_space>" + "AND<seq2seq4repair_space>org.OrgID<seq2seq4repair_space>=<seq2seq4repair_space>userOrg.OrgID<seq2seq4repair_space>" ) + "AND<seq2seq4repair_space>user.UserID<seq2seq4repair_space>=<seq2seq4repair_space>:userId" ) ) <END_BUG> public List < Organization > findOrganizationsByUserId ( @ Bind ( "userId" ) long userId ) ; @ SqlQuery ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>Organization<seq2seq4repair_space>WHERE<seq2seq4repair_space>OrgID<seq2seq4repair_space>=<seq2seq4repair_space>:orgId" ) public Organization findOrganization ( @ Bind ( "orgId" ) int id ) { } @ SqlUpdate ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>Organization<seq2seq4repair_space>(Name,<seq2seq4repair_space>Description,<seq2seq4repair_space>City,<seq2seq4repair_space>State,<seq2seq4repair_space>Country)<seq2seq4repair_space>VALUES<seq2seq4repair_space>(:name,<seq2seq4repair_space>:desc,<seq2seq4repair_space>:city,<seq2seq4repair_space>:state,<seq2seq4repair_space>:country)" ) @ GetGeneratedKeys public long insertOrganization ( @ Bind ( "name" ) String name , @ Bind ( "desc" ) String description , @ Bind ( "city" ) String city , @ Bind ( "state" ) String state , @ Bind ( "country" ) String country ) { } @ SqlUpdate ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>UserOrganization<seq2seq4repair_space>(OrgID,<seq2seq4repair_space>UserID)<seq2seq4repair_space>values<seq2seq4repair_space>(:orgId,<seq2seq4repair_space>:userId)" ) public void registerOrganization ( @ Bind ( "orgId" ) long orgId , @ Bind ( "userId" ) long userId ) { } @ SqlUpdate ( "UPDATE<seq2seq4repair_space>Organization<seq2seq4repair_space>SET<seq2seq4repair_space>MemberCount<seq2seq4repair_space>=<seq2seq4repair_space>MemberCount<seq2seq4repair_space>+<seq2seq4repair_space>1<seq2seq4repair_space>WHERE<seq2seq4repair_space>OrgID<seq2seq4repair_space>=<seq2seq4repair_space>:orgId" ) public void incrementOrgMembers ( @ Bind ( "orgId" ) long orgId ) { } @ SqlUpdate ( "DELETE<seq2seq4repair_space>FROM<seq2seq4repair_space>UserOrganization<seq2seq4repair_space>WHERE<seq2seq4repair_space>OrgID<seq2seq4repair_space>=<seq2seq4repair_space>:orgId<seq2seq4repair_space>AND<seq2seq4repair_space>UserID<seq2seq4repair_space>=<seq2seq4repair_space>:userId" ) public void removeUserOrganization ( @ Bind ( "orgId" ) long orgId , @ Bind ( "userId" ) long userId ) { } @ SqlUpdate ( "UPDATE<seq2seq4repair_space>Organization<seq2seq4repair_space>SET<seq2seq4repair_space>MemberCount<seq2seq4repair_space>=<seq2seq4repair_space>MemberCount<seq2seq4repair_space>-<seq2seq4repair_space>1<seq2seq4repair_space>WHERE<seq2seq4repair_space>OrgID<seq2seq4repair_space>=<seq2seq4repair_space>:orgId" ) public void decrementOrgMembers ( @ Bind ( "orgId" ) long orgId ) { } }

Fix:
@ SqlQuery ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>Organization<seq2seq4repair_space>org,<seq2seq4repair_space>User<seq2seq4repair_space>user,<seq2seq4repair_space>UserOrganization<seq2seq4repair_space>userOrg<seq2seq4repair_space>" + ( ( "WHERE<seq2seq4repair_space>userOrg.UserID<seq2seq4repair_space>=<seq2seq4repair_space>user.UserID<seq2seq4repair_space>" + "AND<seq2seq4repair_space>org.OrgID<seq2seq4repair_space>=<seq2seq4repair_space>userOrg.OrgID<seq2seq4repair_space>" ) + "AND<seq2seq4repair_space>user.UserID<seq2seq4repair_space>=<seq2seq4repair_space>:userId" ) )