Package org.apache.torque.map

Examples of org.apache.torque.map.DatabaseMap


        if (dbName == null)
        {
            dbName = Torque.getDefaultDB();
        }
        DatabaseMap databaseMap = Torque.getDatabaseMap(dbName);
        if (databaseMap == null)
        {
            throw new TorqueException("Could not find database map"
                    + " for database "
                    + dbName);
        }
        String unqualifiedTableName = getUnqualifiedName(tableName, dbName);
        TableMap result = databaseMap.getTable(unqualifiedTableName);
        if (result == null)
        {
            throw new TorqueException("Could not find table "
                    + tableName
                    + " in database map of database "
View Full Code Here


        Column databaseColumn = resolveAliasAndAsColumnAndSchema(
                column,
                criteria);
        ColumnMap columnMap = null;
        {
            DatabaseMap databaseMap = database.getDatabaseMap();
            TableMap tableMap = databaseMap.getTable(
                    databaseColumn.getTableName());
            if (tableMap != null)
            {
                columnMap = tableMap.getColumn(
                        databaseColumn.getColumnName());
View Full Code Here

    /**
     * Verifies that the MapBuilder is available in the DatabaseMap.
     */
    public void testMapBuilder()
    {
        DatabaseMap dbMap = null;

        try
        {
            dbMap = torque.getDatabaseMap(AuthorPeer.DATABASE_NAME);
        }
        catch (TorqueException e)
        {
            fail(e.getMessage());
        }

        assertTrue("Table author should be in the DatabaseMap",
                dbMap.containsTable(AuthorPeer.TABLE_NAME));
        assertFalse("Torque instances should be different", torque == instance);
    }
View Full Code Here

    public void testDeleteWithQualifiedTableName()
            throws Exception
    {
        // prepare
        DatabaseMap fullyQualifiedDatatabaseMap
            = Torque.getDatabaseMap("fullyQualifiedDatatabaseMap");
        TableMap tableMap = new TableMap(
                "schema.fully_qualified_table",
                fullyQualifiedDatatabaseMap);
        ColumnMap columnMap = new ColumnMap("column", tableMap);
View Full Code Here

     */
    public void setUp() throws Exception
    {
        super.setUp();
        c = new Criteria();
        DatabaseMap databaseMap = Torque.getDatabaseMap("postgresql");
        if (!databaseMap.containsTable("TABLE"))
        {
            TableMap tableMap = databaseMap.addTable("TABLE");
            {
                ColumnMap columnMap1 = new ColumnMap("COLUMN1", tableMap);
                columnMap1.setType(new String(""));
                columnMap1.setJavaType("String");
                tableMap.addColumn(columnMap1);
View Full Code Here

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

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

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

View Full Code Here

    @Override
    public void setUp() throws Exception
    {
        super.setUp();
        c = new Criteria();
        DatabaseMap databaseMap = Torque.getDatabaseMap("postgresql");
        if (!databaseMap.containsTable("TABLE"))
        {
            TableMap tableMap = databaseMap.addTable("TABLE");
            {
                ColumnMap columnMap1 = new ColumnMap("COLUMN1", tableMap);
                columnMap1.setType(new String(""));
                columnMap1.setJavaType("String");
                tableMap.addColumn(columnMap1);
View Full Code Here

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

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

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

View Full Code Here

     */
    public static void doDelete(Criteria criteria, Connection con)
        throws TorqueException
    {
        String dbName = criteria.getDbName();
        final DatabaseMap dbMap = Torque.getDatabaseMap(dbName);

        // This Callback adds all tables to the Table set which
        // are referenced from a cascading criteria. As a result, all
        // data that is referenced through foreign keys will also be
        // deleted.
        SQLBuilder.TableCallback tc = new SQLBuilder.TableCallback() {
                public void process (Set tables, String key, Criteria crit)
                {
                    if (crit.isCascade())
                    {
                        // This steps thru all the columns in the database.
                        TableMap[] tableMaps = dbMap.getTables();
                        for (int i = 0; i < tableMaps.length; i++)
                        {
                            ColumnMap[] columnMaps = tableMaps[i].getColumns();

                            for (int j = 0; j < columnMaps.length; j++)
View Full Code Here

                    + "anything specified to insert");
        }

        String dbName = criteria.getDbName();
        Database database = Torque.getDatabase(dbName);
        DatabaseMap dbMap = database.getDatabaseMap();
        TableMap tableMap = dbMap.getTable(table);
        Object keyInfo = tableMap.getPrimaryKeyMethodInfo();
        IdGenerator keyGen
                = database.getIdGenerator(tableMap.getPrimaryKeyMethod());

        ColumnMap pk = getPrimaryKey(criteria);
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.