/** * Adds a sql projection to the criteria * * @param sql SQL projecting a single value * @param columnAlias column alias for the projected value * @param type the type of the projected value */ protected void sqlProjection(String sql, String columnAlias, Type type) { sqlProjection(sql, CollectionUtils.newList(columnAlias), CollectionUtils.newList(type)); }
private static final Set<String> GROOVY_METHODS = CollectionUtils.newSet( "invokeMethod", "getMetaClass",
public static GroovyAwareJavassistProxyFactory buildProxyFactory(PersistentClass persistentClass) { GroovyAwareJavassistProxyFactory proxyFactory = new GroovyAwareJavassistProxyFactory(); @SuppressWarnings("unchecked") Set<Class<HibernateProxy>> proxyInterfaces = CollectionUtils.newSet(HibernateProxy.class); final Class<?> javaClass = persistentClass.getMappedClass(); final Property identifierProperty = persistentClass.getIdentifierProperty(); final Getter idGetter = identifierProperty!=null? identifierProperty.getGetter(javaClass) : null; final Setter idSetter = identifierProperty!=null? identifierProperty.getSetter(javaClass) : null; if (idGetter == null || idSetter == null) return null; try { proxyFactory.postInstantiate(persistentClass.getEntityName(), javaClass, proxyInterfaces, idGetter.getMethod(), idSetter.getMethod(), persistentClass.hasEmbeddedIdentifier() ? (CompositeType) persistentClass.getIdentifier().getType() : null); } catch (HibernateException e) { LOG.warn("Cannot instantiate proxy factory: " + e.getMessage()); return null; } return proxyFactory; }