Package org.apache.torque.map

Examples of org.apache.torque.map.DatabaseMap


        String table,
        String dbName,
        Criteria criteria)
        throws TorqueException
    {
        DatabaseMap dbMap = Torque.getDatabaseMap(dbName);

        ColumnMap[] columnMaps = dbMap.getTable(table).getColumns();
        boolean shouldSave = false;
        for (int j = 0; j < columnMaps.length; j++)
        {
            ColumnMap colMap = columnMaps[j];
            String colName = colMap.getColumnName();
View Full Code Here


        String table = criteria.getTableName(key);
        ColumnMap pk = null;

        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++)
            {
                if (columns[i].isPrimaryKey())
                {
View Full Code Here

                String databaseName = criteria.getDbName();
                if (databaseName == null)
                {
                    databaseName = Torque.getDefaultDB();
                }
                DatabaseMap databaseMap = Torque.getDatabaseMap(databaseName);
                if (databaseMap != null)
                {
                    tableMap = databaseMap.getTable(tableName);
                }
                if (tableMap == null)
                {
                    // try aliases
                    Map aliases = criteria.getAliases();
                    if (aliases != null && aliases.get(tableName) != null)
                    {
                        tableName = (String) aliases.get(tableName);
                        tableMap = databaseMap.getTable(tableName);
                    }
                }
                if (tableMap == null)
                {
                    // no description of table available, do not modify anything
View Full Code Here

    private static void processTables(Criteria crit, Set tables, Connection con, ProcessCallback pc)
            throws Exception
    {
        String dbName = crit.getDbName();
        DB db = Torque.getDB(dbName);
        DatabaseMap dbMap = Torque.getDatabaseMap(dbName);

        // create the statements for the tables
        for (Iterator it = tables.iterator(); it.hasNext();)
        {
            String table = (String) it.next();
            KeyDef kd = new KeyDef();
            Set whereClause = new HashSet();

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

            for (int j = 0; j < columnMaps.length; j++)
            {
                ColumnMap colMap = columnMaps[j];
                if (colMap.isPrimaryKey())
View Full Code Here

    {
        Query query = new Query();

        final String dbName = crit.getDbName();
        final DB db = Torque.getDB(dbName);
        final DatabaseMap dbMap = Torque.getDatabaseMap(dbName);

        JoinBuilder.processJoins(db, dbMap, crit, query);
        processModifiers(crit, query);
        processSelectColumns(crit, query, dbName);
        processAsColumns(crit, query);
View Full Code Here

     * Checks whether orderBy works.
     */
    public void testOrderBy() throws TorqueException
    {
        // we need a rudementary databaseMap for this test case to work
        DatabaseMap dbMap = Torque.getDatabaseMap(Torque.getDefaultDB());

        TableMap tableMap = new TableMap("AUTHOR", dbMap);
        dbMap.addTable(tableMap);

        ColumnMap columnMap = new ColumnMap("NAME", tableMap);
        columnMap.setType("");
        tableMap.addColumn(columnMap);

View Full Code Here

     */
    public synchronized DatabaseMap getDatabaseMap()
    {
        if (databaseMap == null)
        {
            databaseMap = new DatabaseMap(name);
        }
        return databaseMap;
    }
View Full Code Here

     *
     * @return true if a new IDBroker was created, false otherwise.
     */
    public synchronized boolean startIDBroker()
    {
        DatabaseMap dbMap = getDatabaseMap();
        if (dbMap.getIDBroker() != null)
        {
            return false;
        }
        return dbMap.startIdBroker();
    }
View Full Code Here

    {
        Torque.registerMapBuilder(MapBuilderA.CLASS_NAME);
        Torque.init(getConfiguration());
        BasePeer.getMapBuilder(MapBuilderB.CLASS_NAME);

        DatabaseMap databaseMap = Torque.getDatabaseMap(Torque.getDefaultDB());
        assertNotNull(databaseMap.getTable(MapBuilderA.TABLE_NAME));
        assertNotNull(databaseMap.getTable(MapBuilderB.TABLE_NAME));
    }
View Full Code Here

    {
        if (dbMaps != null)
        {
            for (Iterator it = dbMaps.values().iterator(); it.hasNext();)
            {
                DatabaseMap map = (DatabaseMap) it.next();
                IDBroker idBroker = map.getIDBroker();
                if (idBroker != null)
                {
                    idBroker.stop();
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.torque.map.DatabaseMap

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.