Package org.paquitosoft.lml.model.dao

Examples of org.paquitosoft.lml.model.dao.IDefaultDAO


     * @throws InternalErrorException
     */
    public T execute(Connection connection) throws InternalErrorException {

        // Create an instance of default DAO
        IDefaultDAO dao = DAOFactory.getDefaultDAO(connection);

        // Check join table name
        if (joinTableName == null) {
            throw new InternalErrorException("FindExternalRelatedEntitiesAction::execute -> The attribute you're trying to fetch '" +
                    externalAssociatedAttribute.getName() + "' does not have a 'joinTableName' annotation value.");
        }

        // Get the list type
        Class listType = LMLGlobalOperations.getCollectionType(externalAssociatedAttribute);

        // Execute query
        List<T> result = dao.findJoinEntities(entity, listType, joinTableName);

        for (T ent : result) {
            ent = (T) new ReadEntityAction(ent, detailLevel).execute(connection);
        }
       
View Full Code Here


    }
   
    public T execute(Connection connection) throws InternalErrorException {
       
        // Create an instance of default DAO
        IDefaultDAO dao = DAOFactory.getDefaultDAO(connection);
       
        // Execute query
        List<T> result = dao.finder(entityType, query, params);
    
        // Count selected fields       
        String[] selectFields = query.substring(query.indexOf("SELECT") + 7, query.indexOf("FROM") - 1).split(",");
        int entityFieldsCount = ModelUtilities.getAllPersistentEntityFields(entityType).size();
       
View Full Code Here

        // Look for the entity only when it's needed
        T result = entity;
        if (result == null) {
           
            // Create an instance of default dao
            IDefaultDAO dao = DAOFactory.getDefaultDAO(connection);

            // Read entity table
            result = dao.read(entityType, entityId);

        }
       
        // Complete with related entities
        fillEntity(result, detailLevel, connection);
View Full Code Here

       
        // Get cascade attributes from entity
        List<Field> cascadeAttributes = ModelUtilities.getCascadeAttributes(entity.getClass());
       
        // Get default DAO
        IDefaultDAO dao = DAOFactory.getDefaultDAO(connection);
        T result = entity;
       
        if (PERSIST_MODE_SAVE == mode) {
            result = dao.insert(entity);
            persistAssociatedAttributes(cascadeAttributes, connection, entity, mode); // AFTER
        } else if (PERSIST_MODE_UPDATE == mode) {
            result = dao.update(entity);
            persistAssociatedAttributes(cascadeAttributes, connection, entity, mode); // AFTER
        } else if (PERSIST_MODE_DELETE == mode) {
            try {
                persistAssociatedAttributes(cascadeAttributes, connection, entity, mode); // BEFORE
                dao.remove(entity.getClass(), ModelUtilities.getEntityIdentifier(entity));
            } catch (ReflectionException ex) {
                throw new InternalErrorException("PersisAction::execute::removeEntity", ex);
            }
        } else {
            throw new InternalErrorException("PersistAction::execute -> Unknown mode operation: " + mode);
View Full Code Here

TOP

Related Classes of org.paquitosoft.lml.model.dao.IDefaultDAO

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.