agave-common/common-core/src/main/java/org/iplantc/service/common/dao/TenantDao.java
/**
	 * Checks for the existence of a tenant with the given {@link Tenant#getTenantCode()}
	 * @param tenantCode the tenantCode to lookup
	 * @return true if a tenant with the given tenantCode exists. False otherwise
	 * @throws TenantException if unable to query
	 */
Checks for the existence of a tenant with the given  Tenant#getTenantCode()
@param tenantCode the tenantCode to lookup
@return true if a tenant with the given tenantCode exists. False otherwise
@throws TenantException if unable to query
Checks for the existence of a tenant with the given Tenant#getTenantCode () @param tenantCode the tenantCode to lookup @return true if a tenant with the given tenantCode exists . False otherwise @throws TenantException if unable to query
public boolean exists(String tenantCode) throws TenantException
	{
		try
		{
			Session session = getSession();
			session.clear();
			Long matches = ((Long) session.createQuery("select count(id) from Tenant t where t.tenantCode = :tenantCode")
					.setString("tenantCode",  tenantCode)
					.uniqueResult()).longValue();
			session.flush();
			return matches > 0;
		}
		catch (HibernateException ex)
		{
			throw new TenantException(ex);
		}
		finally {
			try { HibernateUtil.commitTransaction();} catch (Exception ignored) {}
		}
	}
public boolean exists ( String tenantCode ) throws TenantException { try { Session session = getSession ( ) ; session . clear ( ) ; Long matches = ( ( Long ) session . createQuery ( "select count(id) from Tenant t where t.tenantCode = :tenantCode" ) . setString ( "tenantCode" , tenantCode ) . uniqueResult ( ) ) . longValue ( ) ; session . flush ( ) ; return matches > 0 ; } catch ( HibernateException ex ) { throw new TenantException ( ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Checks for the existence of a tenant with the given {@link Tenant#getTenantCode()}
 @param tenantCode the tenantCode to lookup
 @return true if a tenant with the given tenantCode exists.
Checks for the existence of a tenant with the given { @link Tenant#getTenantCode () } @param tenantCode the tenantCode to lookup @return true if a tenant with the given tenantCode exists .