Package org.datanucleus.store.rdbms.sql

Examples of org.datanucleus.store.rdbms.sql.SQLTable


            {
                Class implType = clr.classForName(implMappings[i].getType());
                if (type.isAssignableFrom(implType))
                {
                    DatastoreClass castTable = storeMgr.getDatastoreClass(type.getName(), clr);
                    SQLTable castSqlTbl = stmt.leftOuterJoin(table, implMappings[i], refMapping,
                        castTable, null, castTable.getIdMapping(), null, null, null);
                    return exprFactory.newExpression(stmt, castSqlTbl, castTable.getIdMapping());
                }
            }

            // No implementation matching this cast type, so return false
            NucleusLogger.QUERY.warn("Unable to process cast of interface field to " + type.getName() +
                " since it has no implementations that match that type");
            JavaTypeMapping m = exprFactory.getMappingForType(boolean.class, true);
            return exprFactory.newLiteral(stmt, m, false).eq(exprFactory.newLiteral(stmt, m, true));
        }
        else if (mapping instanceof PersistableMapping)
        {
            // Check if there is already the cast table in the current table group
            DatastoreClass castTable = storeMgr.getDatastoreClass(type.getName(), clr);
            SQLTable castSqlTbl = stmt.getTable(castTable, table.getGroupName());
            if (castSqlTbl == null)
            {
                // Join not present, so join to the cast table
                castSqlTbl = stmt.leftOuterJoin(table, table.getTable().getIdMapping(),
                    castTable, null, castTable.getIdMapping(), null, table.getGroupName());
View Full Code Here


            DiscriminatorMetaData dismd = memberTable.getDiscriminatorMetaData();
            DiscriminatorMapping discMapping = (DiscriminatorMapping)memberTable.getDiscriminatorMapping(false);
            if (discMapping != null)
            {
                SQLTable targetSqlTbl = null;
                if (mapping.getDatastoreContainer() != memberTable)
                {
                    // FK is on source table so inner join to target table (holding the discriminator)
                    targetSqlTbl = stmt.getTable(memberTable, null);
                    if (targetSqlTbl == null)
                    {
                        targetSqlTbl = stmt.innerJoin(getSQLTable(), mapping, memberTable, null, memberTable.getIdMapping(),
                            null, null);
                    }
                }
                else
                {
                    // FK is on target side and already joined
                    targetSqlTbl = SQLStatementHelper.getSQLTableForMappingOfTable(stmt, getSQLTable(), discMapping);
                }

                // Add restrict to discriminator for the instanceOf type and subclasses
                SQLTable discSqlTbl = targetSqlTbl;
                BooleanExpression discExpr =
                    SQLStatementHelper.getExpressionForDiscriminatorForClass(stmt, type.getName(),
                        dismd, discMapping, discSqlTbl, clr);

                Iterator subclassIter = storeMgr.getSubClassesForClass(type.getName(), true, clr).iterator();
View Full Code Here

                throw new NucleusException("INDEX expression for field " + mmd.getFullFieldName() +
                    " does not represent an indexed list!");
            }

            JavaTypeMapping orderMapping = null;
            SQLTable orderTable = null;
            DatastoreContainerObject joinTbl = stmt.getRDBMSManager().getDatastoreContainerObject(mmd);
            if (joinTbl != null)
            {
                // 1-N via join table
                CollectionTable collTable = (CollectionTable)joinTbl;
View Full Code Here

TOP

Related Classes of org.datanucleus.store.rdbms.sql.SQLTable

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.