public SpatialReferenceSystem queryForOrganizationCoordsysId ( String organization , long organizationCoordsysId ) throws SQLException { SpatialReferenceSystem srs = null ; QueryBuilder < SpatialReferenceSystem , Long > qb = queryBuilder ( ) ; qb . where ( ) . like ( SpatialReferenceSystem . COLUMN_ORGANIZATION , organization ) ; qb . where ( ) . eq ( SpatialReferenceSystem . COLUMN_ORGANIZATION_COORDSYS_ID , organizationCoordsysId ) ; PreparedQuery < SpatialReferenceSystem > preparedQuery = qb . prepare ( ) ; List < SpatialReferenceSystem > results = query ( preparedQuery ) ; if ( ! results . isEmpty ( ) ) { if ( results . size ( ) > 1 ) { throw new SQLException ( "More than one " + SpatialReferenceSystem . class . getSimpleName ( ) + " returned for Organization: " + organization + ", Organization Coordsys Id: " + organizationCoordsysId ) ; } srs = results . get ( 0 ) ; } return srs ; }
Query for the organization coordsys id