agave-common/common-core/src/main/java/org/iplantc/service/common/dao/TenantDao.java
/**
	 * Retrieves a tenant by its unique tenantId
	 * @param tenantId the tenant code to lookup
	 * @return the matching {@link Tenant}
	 * @throws TenantException if unable to query
	 */
Retrieves a tenant by its unique tenantId
@param tenantId the tenant code to lookup
@return the matching  Tenant
@throws TenantException if unable to query
Retrieves a tenant by its unique tenantId @param tenantId the tenant code to lookup @return the matching Tenant @throws TenantException if unable to query
public Tenant findByTenantId(String tenantId) throws TenantException
	{
		if (!tenantCache.containsKey(tenantId)) {
			try
			{
				Session session = getSession();
				session.clear();
				Tenant tenant = (Tenant) session.createQuery("from Tenant t where t.tenantCode = :tenantCode")
						.setCacheable(true)
						.setCacheMode(CacheMode.NORMAL)
						.setString("tenantCode",  tenantId)
						.uniqueResult();
				session.flush();
				if (tenant != null) {
					tenantCache.put(tenantId, tenant);
				}
			}
			catch (HibernateException ex)
			{
				throw new TenantException(ex);
			}
			finally {
				try { HibernateUtil.commitTransaction();} catch (Exception ignored) {}
			}
		}
		return tenantCache.get(tenantId);
	}
public Tenant findByTenantId ( String tenantId ) throws TenantException { if ( ! tenantCache . containsKey ( tenantId ) ) { try { Session session = getSession ( ) ; session . clear ( ) ; Tenant tenant = ( Tenant ) session . createQuery ( "from Tenant t where t.tenantCode = :tenantCode" ) . setCacheable ( true ) . setCacheMode ( CacheMode . NORMAL ) . setString ( "tenantCode" , tenantId ) . uniqueResult ( ) ; session . flush ( ) ; if ( tenant != null ) { tenantCache . put ( tenantId , tenant ) ; } } catch ( HibernateException ex ) { throw new TenantException ( ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } } return tenantCache . get ( tenantId ) ; }
Retrieves a tenant by its unique tenantId
 @param tenantId the tenant code to lookup
 @return the matching {@link Tenant}
 @throws TenantException if unable to query
Retrieves a tenant by its unique tenantId @param tenantId the tenant code to lookup @return the matching { @link Tenant } @throws TenantException if unable to query