Package com.alibaba.druid.mapping

Examples of com.alibaba.druid.mapping.Entity


        }
    }

    public static void setTableSource(MappingEngine engine, SQLUpdateStatement stmt, MappingContext context) {
        if (stmt.getTableSource() == null) {
            Entity entity = engine.getFirstEntity(context);
            stmt.setTableSource(new SQLIdentifierExpr(entity.getName()));
        }
    }
View Full Code Here


        }
    }

    public static void setTableSource(MappingEngine engine, SQLInsertStatement stmt, MappingContext context) {
        if (stmt.getTableSource() == null) {
            Entity entity = engine.getFirstEntity(context);
            stmt.setTableSource(new SQLIdentifierExpr(entity.getName()));
        }
    }
View Full Code Here

        if (expr instanceof SQLIdentifierExpr) {
            SQLIdentifierExpr tableExpr = (SQLIdentifierExpr) expr;
            String entityName = tableExpr.getName();

            Entity entity = visitor.getEntity(entityName);

            if (entity == null) {
                throw new DruidMappingException("entity not foudn : " + entityName);
            }

            tableExpr.setName(entity.getTableName());
        }

        if (x.getAlias() != null) {
            visitor.getTableSources().put(x.getAlias(), x);
        }
View Full Code Here

        return true;
    }

    public static void fillSelectList(MappingVisitor visitor, SQLSelectQueryBlock x) {
        Entity entity = visitor.getFirstEntity();

        for (Property item : entity.getProperties().values()) {
            x.getSelectList().add(new SQLSelectItem(new SQLIdentifierExpr(item.getName()), '"' + item.getName() + '"'));
        }
    }
View Full Code Here

                fillSelectList(visitor, x);
            }
        }

        if (x.getFrom() == null) {
            Entity firstEntity = visitor.getFirstEntity();
            SQLExprTableSource from = new SQLExprTableSource(new SQLIdentifierExpr(firstEntity.getName()));
            x.setFrom(from);
        }

        for (SQLSelectItem item : x.getSelectList()) {
            item.setParent(x);
View Full Code Here

        return true;
    }

    public static Entity getEntity(MappingVisitor visitor, String name) {
        Entity entity = visitor.getEntities().get(name);

        if (entity == null) {
            for (Map.Entry<String, Entity> entry : visitor.getEntities().entrySet()) {
                if (entry.getKey().equalsIgnoreCase(name)) {
                    entity = entry.getValue();
View Full Code Here

        return entity;
    }

    public static void setDataSource(MappingEngine engine, SQLDeleteStatement stmt) {
        if (stmt.getExprTableSource() == null) {
            Entity entity = engine.getFirstEntity();
            stmt.setTableSource(new SQLIdentifierExpr(entity.getName()));
        }
    }
View Full Code Here

        }
    }
   
    public static void setDataSource(MappingEngine engine, SQLUpdateStatement stmt) {
        if (stmt.getTableSource() == null) {
            Entity entity = engine.getFirstEntity();
            stmt.setTableSource(new SQLIdentifierExpr(entity.getName()));
        }
    }
View Full Code Here

        }
    }
   
    public static void setDataSource(MappingEngine engine, SQLInsertStatement stmt) {
        if (stmt.getTableSource() == null) {
            Entity entity = engine.getFirstEntity();
            stmt.setTableSource(new SQLIdentifierExpr(entity.getName()));
        }
    }
View Full Code Here

    public static boolean visit(MappingVisitor visitor, SQLIdentifierExpr x) {
        String propertyName = x.getName();

        Property property = null;
        Entity propertyEntity = null;

        for (SQLTableSource tableSource : visitor.getTableSources().values()) {
            Entity entity = (Entity) tableSource.getAttribute(MAPPING_ENTITY);
            if (entity != null) {
                property = entity.getProperty(propertyName);
                if (property != null) {
                    propertyEntity = entity;
                    break;
                }
            }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.mapping.Entity

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.