Package org.paquitosoft.lml.model.exception

Examples of org.paquitosoft.lml.model.exception.InternalErrorException


        } 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);
        }
       
        return result;
    }
View Full Code Here


            // Execute insert query
            int i = stm.executeUpdate();

            // We must have inserted exactly one row
            if (i != 1) {
                    throw new InternalErrorException("ERROR: DELETE METHOD FAILED. " + i + " records have been deleted.");
            }

        } catch (SQLException e) {
            logger.log(Level.SEVERE, "SQL Exception while inserting: " + e.getMessage(), e);
            throw new InternalErrorException("Database Exception....", e);
        } catch (IllegalAccessException e) {
            logger.log(Level.SEVERE, "Reflection exception while inserting: " + e.getMessage(), e);
            throw new ReflectionException("DefaultDAO::remove\n", e);
        } finally {
                closeResouces(stm, null);
View Full Code Here

                AssociationType at = ModelUtilities.getAssociationType(f, mode);
               
                if (f.getAnnotation(PersistentAttribute.class) != null){
                    try {
                        if (fieldValue == null && AssociationType.REQUIRED.equals(at)) {
                            throw new InternalErrorException("PersistAction::persistAssociatedAttributes -> You tried to persist a null value for " +
                                    "a required associated attribute: " + f.getName());
                        } else if (fieldValue == null) {
                            continue;
                        } else if (fieldValue != null && !AssociationType.NONE.equals(at)) {
                            f.set(entity, new PersistAction(fieldValue, mode).execute(connection));
                        }                       
                    } catch (DuplicateInstanceException e) {
                        if (AssociationType.REQUIRED.equals(at)) {
                            logger.log(Level.WARNING, "PersistAction::execute::persistAssociatedAttributes -> You tried to persist (" + mode + ") an " +
                                "associated entity that it's already in the database: " + f.get(entity).toString());
                            throw e;
                        }
                    } catch (DataNotFoundException e) {
                        if (AssociationType.REQUIRED.equals(at)) {
                            logger.log(Level.WARNING, "PersistAction::execute::persistAssociatedAttributes -> You tried to persist (" + mode + ") an " +
                                "associated entity that it's not in the database: " + f.get(entity).toString());
                            throw e;
                        }
                    }
                } else if (f.getAnnotation(AssociatedEntityList.class) != null) {                                       
                    if (fieldValue == null && AssociationType.REQUIRED.equals(at)) {
                        throw new InternalErrorException("PersistAction::persistAssociatedAttributes -> You tried to persist a null value for " +
                                    "a required associated entity list: " + f.getName());
                    } else if (fieldValue == null) {
                        continue;
                    }
                    ArrayList<?> associatedEntityList = (ArrayList<?>) fieldValue;
View Full Code Here

            // Execute insert query
            int i = stm.executeUpdate();

            // We must have updated exactly one row
            if (i != 1) {
                    throw new InternalErrorException("ERROR: UPDATE METHOD FAILED. " + i + " records have been updated.");
            }

        } catch (SQLException e) {
            logger.log(Level.SEVERE, "SQL Exception while inserting: " + e.getMessage(), e);
            throw new InternalErrorException("Database Exception....", e);
        } catch (IllegalAccessException e) {
            logger.log(Level.SEVERE, "Reflection exception while inserting: " + e.getMessage(), e);
            throw new ReflectionException("DefaultDAO::update\n", e);
        } finally {
                closeResouces(stm, null);
View Full Code Here

                        throw new DataNotFoundException("DefaultDAO::finder -> Data not found!");
                }

        } catch (SQLException e) {
            logger.log(Level.SEVERE, "SQL Exception while finding: " + e.getMessage(), e);
            throw new InternalErrorException(e);
        } finally {
            closeResouces(stm, rs);
        }

        return result;
View Full Code Here

                        throw new DataNotFoundException("DefaultDAO::findJoinEntities -> Data not found!");
                }

        } catch (SQLException e) {
            logger.log(Level.SEVERE, "SQL Exception while finding: " + e.getMessage(), e);
            throw new InternalErrorException(e);
        } catch (IllegalAccessException e) {
            logger.log(Level.SEVERE, "Reflection exception while inserting: " + e.getMessage(), e);
            throw new ReflectionException("DefaultDAO::findJoinEntities \n", e);
        } finally {
            closeResouces(stm, rs);
View Full Code Here

        if (stm != null) {
            try {
                stm.close();
            } catch (Exception exception) {
                logger.log(Level.SEVERE, "Close statement exception while reading from database: " + exception.getMessage(), exception);
                throw new InternalErrorException(exception);
            }
        }
        if (rs != null) {
            try {
                rs.close();
            } catch (Exception exception) {
                logger.log(Level.SEVERE, "Close resultSet exception while reading from database: " + exception.getMessage(), exception);
                throw new InternalErrorException(exception);
            }
        }
    }
View Full Code Here

                instance = new ConnectionPool();
                Class.forName(LMLGlobalOperations.getConnectionSetting(CONNECTION_SETTINGS_DRIVER).trim());
                initPool();
            } catch (ClassNotFoundException ex) {
                instance = null; // If initialization fails we need to set null to instance in order to recreate it next time we try; otherwise it won't invoke initPool method again
                throw new InternalErrorException("ConnectionPool::getInstance -> Could not load driver: " +
                        LMLGlobalOperations.getConnectionSetting(CONNECTION_SETTINGS_DRIVER).trim(), ex);
            } catch (SQLException ex) {
                instance = null; // If initialization fails we need to set null to instance in order to recreate it next time we try; otherwise it won't invoke initPool method again
                throw new InternalErrorException("ConnectionPool::getInstance -> SQL problem.", ex);
            }
           
        }
       
        return instance;
View Full Code Here

TOP

Related Classes of org.paquitosoft.lml.model.exception.InternalErrorException

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.