Package org.datanucleus.store.rdbms.sql

Examples of org.datanucleus.store.rdbms.sql.SQLStatement.select()


                // Collection<PC>
                DatastoreClass elemTbl = storeMgr.getDatastoreClass(elemType, clr);
                subStmt = new SQLStatement(stmt, storeMgr, elemTbl, null, null);
                subStmt.setClassLoaderResolver(clr);
                JavaTypeMapping oneMapping = storeMgr.getMappingManager().getMapping(Integer.class);
                subStmt.select(exprFactory.newLiteral(subStmt, oneMapping, 1), null);

                // Join to join table
                SQLTable joinSqlTbl = subStmt.innerJoin(subStmt.getPrimaryTable(), elemTbl.getIdMapping(),
                    joinTbl, null, joinTbl.getElementMapping(), null, null);
View Full Code Here


            // FK Collection
            DatastoreClass elemTbl = storeMgr.getDatastoreClass(mmd.getCollection().getElementType(), clr);
            subStmt = new SQLStatement(stmt, storeMgr, elemTbl, null, null);
            subStmt.setClassLoaderResolver(clr);
            JavaTypeMapping oneMapping = storeMgr.getMappingManager().getMapping(Integer.class);
            subStmt.select(exprFactory.newLiteral(subStmt, oneMapping, 1), null);

            // Restrict to collection owner
            JavaTypeMapping ownerMapping = null;
            if (mmd.getMappedBy() != null)
            {
View Full Code Here

            subStmt.setClassLoaderResolver(clr);
            JavaTypeMapping mapping =
                storeMgr.getMappingManager().getMappingWithDatastoreMapping(String.class, false, false, clr);
            SQLExpression countExpr = exprFactory.newLiteral(subStmt, mapping, "COUNT(*)");
            ((StringLiteral)countExpr).generateStatementWithoutQuotes();
            subStmt.select(countExpr, null);

            SQLExpression elementOwnerExpr = exprFactory.newExpression(subStmt, subStmt.getPrimaryTable(),
                ownerMapping);
            SQLExpression ownerIdExpr = exprFactory.newExpression(stmt, expr.getSQLTable(),
                expr.getSQLTable().getTable().getIdMapping());
View Full Code Here

            subStmt.setClassLoaderResolver(clr);
            JavaTypeMapping mapping =
                storeMgr.getMappingManager().getMappingWithDatastoreMapping(String.class, false, false, clr);
            SQLExpression countExpr = exprFactory.newLiteral(subStmt, mapping, "COUNT(*)");
            ((StringLiteral)countExpr).generateStatementWithoutQuotes();
            subStmt.select(countExpr, null);

            SQLExpression elementOwnerExpr = exprFactory.newExpression(subStmt,
                subStmt.getPrimaryTable(), ownerMapping);
            SQLExpression ownerIdExpr = exprFactory.newExpression(stmt, expr.getSQLTable(),
                expr.getSQLTable().getTable().getIdMapping());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.