Package org.apache.torque

Examples of org.apache.torque.TorqueException


        log.debug("Starting initJNDI");

        Configuration c = configuration.subset("jndi");
        if (c == null || c.isEmpty())
        {
            throw new TorqueException(
                "JndiDataSourceFactory requires a jndi "
                    + "path property to lookup the DataSource in JNDI.");
        }

        try
        {
            Hashtable env = new Hashtable();
            for (Iterator i = c.getKeys(); i.hasNext(); )
            {
                String key = (String) i.next();
                if (key.equals("path"))
                {
                    path = c.getString(key);
                    if (log.isDebugEnabled())
                    {
                        log.debug("JNDI path: " + path);
                    }
                }
                else if (key.equals("ttl"))
                {
                    ttl = c.getLong(key, ttl);
                    if (log.isDebugEnabled())
                    {
                        log.debug("Time between context lookups: " + ttl);
                    }
                }
                else
                {
                    String value = c.getString(key);
                    env.put(key, value);
                    if (log.isDebugEnabled())
                    {
                        log.debug("Set jndi property: " + key + "=" + value);
                    }
                }
            }

            ctx = new InitialContext(env);
            log.debug("Created new InitialContext");
            debugCtx(ctx);
        }
        catch (Exception e)
        {
            log.error("", e);
            throw new TorqueException(e);
        }
    }
View Full Code Here


            }
        }
        catch (Exception e)
        {
            log.error("", e);
            throw new TorqueException(e);
        }
    }
View Full Code Here

                results[0] = new BigDecimal(rs.getString(1)); // next_id
                results[1] = new BigDecimal(rs.getString(2)); // quantity
            }
            else
            {
                throw new TorqueException("The table " + tableName
                        + " does not have a proper entry in the " + ID_TABLE);
            }
        }
        finally
        {
View Full Code Here

          ds.close();
        }
        catch (Exception e)
        {
            log.error("Exception caught during close()", e);
            throw new TorqueException(e);
        }
        ds = null;
    }
View Full Code Here

            ds.close();
        }
        catch (Exception e)
        {
            log.error("Exception caught during close()", e);
            throw new TorqueException(e);
        }
        ds = null;
    }
View Full Code Here

        {
            throw (TorqueException)e;
        }
        else
        {
            throw new TorqueException(e);
        }
    }
View Full Code Here

            statement.executeUpdate(query.toString());
        }
        catch (SQLException e)
        {
            throw new TorqueException(e);
        }
        finally
        {
            if (statement != null)
            {
View Full Code Here

        {
            tableName = criteria.getTableName((String) keys.next());
        }
        else
        {
            throw new TorqueException("Database insert attempted without "
                    + "anything specified to insert");
        }

        DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
        TableMap tableMap = dbMap.getTable(tableName);
        Object keyInfo = tableMap.getPrimaryKeyMethodInfo();
        IdGenerator keyGen = tableMap.getIdGenerator();

        ColumnMap pk = getPrimaryKey(criteria);

        // pk will be null if there is no primary key defined for the table
        // we're inserting into.
        if (pk != null && !criteria.containsKey(pk.getFullyQualifiedName()))
        {
            if (keyGen == null)
            {
                throw new TorqueException(
                    "IdGenerator for table '" + tableName + "' is null");
            }
            // If the keyMethod is SEQUENCE or IDBROKERTABLE, get the id
            // before the insert.
View Full Code Here

                throwTorqueException(e);
            }
        }
        else
        {
            throw new TorqueException("No changes to save");
        }
    }
View Full Code Here

        if (!table.equals(""))
        {
            DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
            if (dbMap == null)
            {
                throw new TorqueException("dbMap is null");
            }
            if (dbMap.getTable(table) == null)
            {
                throw new TorqueException("dbMap.getTable() is null");
            }

            ColumnMap[] columns = dbMap.getTable(table).getColumns();

            for (int i = 0; i < columns.length; i++)
View Full Code Here

TOP

Related Classes of org.apache.torque.TorqueException

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.