Package org.jboss.ejb.plugins.cmp.jdbc.metadata

Examples of org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCFunctionMappingMetaData


      // generate the sql
      StringBuffer sql = new StringBuffer(300);
      if(rowLocking && readAhead.isOnFind() && getEagerLoadMask() != null)
      {
         JDBCFunctionMappingMetaData rowLockingTemplate = typeMapping.getRowLockingTemplate();
         rowLockingTemplate.getFunctionSql(
            new Object[]{
               select,
               from,
               where.length() == 0 ? null : where,
               null // order by
View Full Code Here


/*  820 */       addField(type, sql);
/*      */     }
/*      */
/*  824 */     if (this.entityMetaData.hasPrimaryKeyConstraint())
/*      */     {
/*  826 */       JDBCFunctionMappingMetaData pkConstraint = this.manager.getMetaData().getTypeMapping().getPkConstraintTemplate();
/*  827 */       if (pkConstraint == null)
/*      */       {
/*  829 */         throw new IllegalStateException("Primary key constraint is not allowed for this type of data source");
/*      */       }
/*      */
/*  833 */       String defTableName = this.entity.getManager().getMetaData().getDefaultTableName();
/*  834 */       String name = "pk_" + SQLUtil.unquote(defTableName, dataSource);
/*  835 */       name = SQLUtil.fixConstraintName(name, dataSource);
/*  836 */       String[] args = { name, SQLUtil.getColumnNamesClause(this.entity.getPrimaryKeyFields(), new StringBuffer(100)).toString() };
/*      */
/*  840 */       sql.append(", ");
/*  841 */       pkConstraint.getFunctionSql(args, sql);
/*      */     }
/*      */
/*  844 */     return ')';
/*      */   }
View Full Code Here

/*      */     throws DeploymentException
/*      */   {
/*  983 */     if (type.getAutoIncrement()[0] != 0)
/*      */     {
/*  985 */       String columnClause = SQLUtil.getCreateTableColumnsClause(type);
/*  986 */       JDBCFunctionMappingMetaData autoIncrement = this.manager.getMetaData().getTypeMapping().getAutoIncrementTemplate();
/*      */
/*  988 */       if (autoIncrement == null)
/*      */       {
/*  990 */         throw new IllegalStateException("auto-increment template not found");
/*      */       }
/*  992 */       String[] args = { columnClause };
/*  993 */       autoIncrement.getFunctionSql(args, sqlBuffer);
/*      */     }
/*      */     else
/*      */     {
/*  997 */       sqlBuffer.append(SQLUtil.getCreateTableColumnsClause(type));
/*      */     }
View Full Code Here

/* 1012 */     sql.append("CREATE TABLE ").append(cmrField.getQualifiedTableName()).append(" (").append(SQLUtil.getCreateTableColumnsClause(fieldsArr));
/*      */
/* 1018 */     JDBCRelationMetaData relationMetaData = cmrField.getMetaData().getRelationMetaData();
/* 1019 */     if (relationMetaData.hasPrimaryKeyConstraint())
/*      */     {
/* 1021 */       JDBCFunctionMappingMetaData pkConstraint = this.manager.getMetaData().getTypeMapping().getPkConstraintTemplate();
/*      */
/* 1023 */       if (pkConstraint == null)
/*      */       {
/* 1025 */         throw new IllegalStateException("Primary key constraint is not allowed for this type of data store");
/*      */       }
/*      */
/* 1028 */       String name = "pk_" + relationMetaData.getDefaultTableName();
/* 1029 */       name = SQLUtil.fixConstraintName(name, dataSource);
/* 1030 */       String[] args = { name, SQLUtil.getColumnNamesClause(fieldsArr, 100, new StringBuffer()).toString() };
/*      */
/* 1034 */       sql.append(", ");
/* 1035 */       pkConstraint.getFunctionSql(args, sql);
/*      */     }
/* 1037 */     sql.append(')');
/* 1038 */     return sql.toString();
/*      */   }
View Full Code Here

/* 1083 */     if (!createdTables.contains(tableName))
/*      */     {
/* 1085 */       return;
/*      */     }
/*      */
/* 1088 */     JDBCFunctionMappingMetaData fkConstraint = this.manager.getMetaData().getTypeMapping().getFkConstraintTemplate();
/* 1089 */     if (fkConstraint == null)
/*      */     {
/* 1091 */       throw new IllegalStateException("Foreign key constraint is not allowed for this type of datastore");
/*      */     }
/*      */
/* 1093 */     String a = SQLUtil.getColumnNamesClause(fields, new StringBuffer(50)).toString();
/* 1094 */     String b = SQLUtil.getColumnNamesClause(referencesFields, new StringBuffer(50)).toString();
/*      */
/* 1096 */     String[] args = { tableName, SQLUtil.fixConstraintName("fk_" + tableName + "_" + cmrFieldName, dataSource), a, referencesTableName, b };
/*      */
/* 1103 */     String sql = fkConstraint.getFunctionSql(args, new StringBuffer(100)).toString();
/*      */
/* 1107 */     TransactionManager tm = this.manager.getContainer().getTransactionManager();
/*      */     Transaction oldTransaction;
/*      */     try
/*      */     {
View Full Code Here

/*  311 */     this.selectDistinct = ((((ASTSelect)selectNode).distinct) || (this.returnType == Set.class) || (this.forceDistinct));
/*      */
/*  314 */     StringBuffer sql = (StringBuffer)data;
/*  315 */     if ((this.selectManager.getMetaData().hasRowLocking()) && (!(this.selectObject instanceof SelectFunction)))
/*      */     {
/*  317 */       JDBCFunctionMappingMetaData rowLockingTemplate = this.typeMapping.getRowLockingTemplate();
/*  318 */       if (rowLockingTemplate == null)
/*      */       {
/*  320 */         throw new IllegalStateException("Row locking template is not defined for given mapping: " + this.typeMapping.getName());
/*      */       }
/*      */
/*  323 */       boolean distinct = this.selectDistinct;
/*      */
/*  325 */       Object[] args = { distinct ? "DISTINCT " + selectClause : selectClause.toString(), fromClause, (whereClause == null) || (whereClause.length() == 0) ? null : whereClause, (orderByClause == null) || (orderByClause.length() == 0) ? null : orderByClause };
/*      */
/*  331 */       rowLockingTemplate.getFunctionSql(args, sql);
/*      */     }
/*      */     else
/*      */     {
/*  335 */       sql.append("SELECT ");
/*  336 */       if (this.selectDistinct)
View Full Code Here

/*      */   }
/*      */
/*      */   public Object visit(ASTConcat node, Object data)
/*      */   {
/* 1056 */     StringBuffer buf = (StringBuffer)data;
/* 1057 */     JDBCFunctionMappingMetaData function = this.typeMapping.getFunctionMapping("concat");
/* 1058 */     Object[] args = childrenToStringArr(2, node);
/* 1059 */     function.getFunctionSql(args, buf);
/* 1060 */     return data;
/*      */   }
View Full Code Here

/*      */   }
/*      */
/*      */   public Object visit(ASTSubstring node, Object data)
/*      */   {
/* 1065 */     StringBuffer buf = (StringBuffer)data;
/* 1066 */     JDBCFunctionMappingMetaData function = this.typeMapping.getFunctionMapping("substring");
/* 1067 */     Object[] args = childrenToStringArr(3, node);
/* 1068 */     function.getFunctionSql(args, buf);
/* 1069 */     return data;
/*      */   }
View Full Code Here

/*      */   }
/*      */
/*      */   public Object visit(ASTUCase node, Object data)
/*      */   {
/* 1074 */     StringBuffer buf = (StringBuffer)data;
/* 1075 */     JDBCFunctionMappingMetaData function = this.typeMapping.getFunctionMapping("ucase");
/* 1076 */     Object[] args = childrenToStringArr(1, node);
/* 1077 */     function.getFunctionSql(args, buf);
/* 1078 */     return data;
/*      */   }
View Full Code Here

/*      */   }
/*      */
/*      */   public Object visit(ASTLCase node, Object data)
/*      */   {
/* 1083 */     StringBuffer buf = (StringBuffer)data;
/* 1084 */     JDBCFunctionMappingMetaData function = this.typeMapping.getFunctionMapping("lcase");
/* 1085 */     Object[] args = childrenToStringArr(1, node);
/* 1086 */     function.getFunctionSql(args, buf);
/* 1087 */     return data;
/*      */   }
View Full Code Here

TOP

Related Classes of org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCFunctionMappingMetaData

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.