Examples of LRSMapFieldStrategy


Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

        Object key = ((Const) _key).getValue(ctx, gstate.keyState);
        FieldMapping field = map.getFieldMapping(gstate.mapState);
        if (!(field.getStrategy() instanceof LRSMapFieldStrategy))
            throw new UnsupportedOperationException();

        LRSMapFieldStrategy strat = (LRSMapFieldStrategy) field.getStrategy();
        ClassMapping[] clss = strat.getIndependentValueMappings(true);
        if (clss != null && clss.length > 1)
            throw RelationStrategies.unjoinable(field);

        ClassMapping cls = (clss.length == 0) ? null : clss[0];
        ForeignKey fk = strat.getJoinForeignKey(cls);

        // manually create a subselect for the Map's value
        sql.append("(SELECT ");
        Column[] values = field.getElementMapping().getColumns();
        for (int i = 0; i < values.length; i++) {
            if (i > 0)
                sql.append(", ");
            sql.append(values[i].getFullName());
        }
        sql.append(" FROM ").append(values[0].getTable().getFullName()).
            append(" WHERE ");

        // add in the joins
        ContainerFieldStrategy.appendUnaliasedJoin(sql, sel, null,
            ctx.store.getDBDictionary(), field, fk);
        sql.append(" AND ");

        key = strat.toKeyDataStoreValue(key, ctx.store);
        Column[] cols = strat.getKeyColumns(cls);
        Object[] vals = (cols.length == 1) ? null : (Object[]) key;

        for (int i = 0; i < cols.length; i++) {
            sql.append(cols[i].getFullName());
            if (vals == null)
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

    private void selectEmbeddedMapKey(Select sel, ExpContext ctx,
        ExpState state) {
        PathExpState pstate = (PathExpState) state;
        validateMapStrategy(pstate.field.getStrategy());
        LRSMapFieldStrategy strategy = (LRSMapFieldStrategy)
            pstate.field.getStrategy();
        ClassMapping mapping = pstate.field.getKeyMapping().getTypeMapping();
        strategy.selectKey(sel, mapping, null, ctx.store, ctx.fetch,
            pstate.joins);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

    private Object loadEmbeddedMapKey(ExpContext ctx, ExpState state,
        Result res) throws SQLException {
        PathExpState pstate = (PathExpState) state;
        validateMapStrategy(pstate.field.getStrategy());
        LRSMapFieldStrategy strategy =
            (LRSMapFieldStrategy) pstate.field.getStrategy();
        return strategy.loadKey(null, ctx.store, ctx.fetch, res,
            pstate.joins);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

        Object key = ((Const) _key).getValue(ctx, gstate.keyState);
        FieldMapping field = map.getFieldMapping(gstate.mapState);
        if (!(field.getStrategy() instanceof LRSMapFieldStrategy))
            throw new UnsupportedOperationException();

        LRSMapFieldStrategy strat = (LRSMapFieldStrategy) field.getStrategy();
        ClassMapping[] clss = strat.getIndependentValueMappings(true);
        if (clss != null && clss.length > 1)
            throw RelationStrategies.unjoinable(field);

        ClassMapping cls = (clss == null || clss.length == 0) ? null : clss[0];
        ForeignKey fk = strat.getJoinForeignKey(cls);

        // manually create a subselect for the Map's value
        sql.append("(SELECT ");
        Column[] values = field.getElementMapping().getColumns();
        for (int i = 0; i < values.length; i++) {
            if (i > 0)
                sql.append(", ");
            sql.append(values[i].getTable()).append(".").append(values[i]);
        }
        sql.append(" FROM ").append(values[0].getTable());
        sql.append(" WHERE ");

        // add in the joins
        ContainerFieldStrategy.appendUnaliasedJoin(sql, sel, null,
            ctx.store.getDBDictionary(), field, fk);
        sql.append(" AND ");

        key = strat.toKeyDataStoreValue(key, ctx.store);
        Column[] cols = strat.getKeyColumns(cls);
        Object[] vals = (cols.length == 1) ? null : (Object[]) key;

        for (int i = 0; i < cols.length; i++) {
            sql.append(cols[i].getTable()).append(".").append(cols[i]);
            if (vals == null)
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

    private void selectEmbeddedMapKey(Select sel, ExpContext ctx,
        ExpState state) {
        PathExpState pstate = (PathExpState) state;
        validateMapStrategy(pstate.field.getStrategy());
        LRSMapFieldStrategy strategy = (LRSMapFieldStrategy)
            pstate.field.getStrategy();
        ClassMapping mapping = pstate.field.getKeyMapping().getTypeMapping();
        strategy.selectKey(sel, mapping, null, ctx.store, ctx.fetch,
            pstate.joins);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

    private Object loadEmbeddedMapKey(ExpContext ctx, ExpState state,
        Result res) throws SQLException {
        PathExpState pstate = (PathExpState) state;
        validateMapStrategy(pstate.field.getStrategy());
        LRSMapFieldStrategy strategy =
            (LRSMapFieldStrategy) pstate.field.getStrategy();
        return strategy.loadKey(null, ctx.store, ctx.fetch, res,
            pstate.joins);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

    private void selectEmbeddedMapKey(Select sel, ExpContext ctx,
        ExpState state) {
        PathExpState pstate = (PathExpState) state;
        validateMapStrategy(pstate.field.getStrategy());
        LRSMapFieldStrategy strategy = (LRSMapFieldStrategy)
            pstate.field.getStrategy();
        ClassMapping mapping = pstate.field.getKeyMapping().getTypeMapping();
        strategy.selectKey(sel, mapping, null, ctx.store, ctx.fetch,
            pstate.joins);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

    private Object loadEmbeddedMapKey(ExpContext ctx, ExpState state,
        Result res) throws SQLException {
        PathExpState pstate = (PathExpState) state;
        validateMapStrategy(pstate.field.getStrategy());
        LRSMapFieldStrategy strategy =
            (LRSMapFieldStrategy) pstate.field.getStrategy();
        return strategy.loadKey(null, ctx.store, ctx.fetch, res,
            pstate.joins);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

    private void selectEmbeddedMapKey(Select sel, ExpContext ctx,
        ExpState state) {
        PathExpState pstate = (PathExpState) state;
        validateMapStrategy(pstate.field.getStrategy());
        LRSMapFieldStrategy strategy = (LRSMapFieldStrategy)
            pstate.field.getStrategy();
        ClassMapping mapping = pstate.field.getKeyMapping().getTypeMapping();
        strategy.selectKey(sel, mapping, null, ctx.store, ctx.fetch,
            pstate.joins);
    }
View Full Code Here

Examples of org.apache.openjpa.jdbc.meta.strats.LRSMapFieldStrategy

    private Object loadEmbeddedMapKey(ExpContext ctx, ExpState state,
        Result res) throws SQLException {
        PathExpState pstate = (PathExpState) state;
        validateMapStrategy(pstate.field.getStrategy());
        LRSMapFieldStrategy strategy =
            (LRSMapFieldStrategy) pstate.field.getStrategy();
        return strategy.loadKey(null, ctx.store, ctx.fetch, res,
            pstate.joins);
    }
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.