Package yalp.db.jpa

Examples of yalp.db.jpa.GenericModel


        if (value == null) {
            return true;
        }
        final String[] propertyNames = getPropertyNames(
                ((FieldContext) context).getField().getName());
        final GenericModel model = (GenericModel) validatedObject;
        final Model.Factory factory = Model.Manager.factoryFor(model.getClass());
        final String keyProperty = factory.keyName();
        final Object keyValue = factory.keyValue(model);
        //In case of an update make sure that we won't read the current record from database.
        final boolean isUpdate = (keyValue != null);
        final String entityName = model.getClass().getName();
        final StringBuffer jpql = new StringBuffer("SELECT COUNT(o) FROM ");
        jpql.append(entityName).append(" AS o where ");
        final Object[] values = new Object[isUpdate ? propertyNames.length + 1 :
                propertyNames.length];
        final Class clazz = validatedObject.getClass();
View Full Code Here

TOP

Related Classes of yalp.db.jpa.GenericModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.