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

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


      {       
         JDBCTypeMappingMetaData typeMapping = (JDBCTypeMappingMetaData)server.getAttribute(metaDataName, "TypeMappingMetaData");
         if (typeMapping == null)
            throw new IllegalStateException("Cannot obtain type mapping from: " + metaDataName);

         JDBCMappingMetaData objectMetaData = typeMapping.getTypeMappingMetaData(Object.class);
         binarySqlType = objectMetaData.getJdbcType();
        
         if (!SQLUtil.tableExists(getTableName(), ds))
         {
            con = ds.getConnection();

            String dateType = typeMapping.getTypeMappingMetaData(Timestamp.class).getSqlType();
            String longType = typeMapping.getTypeMappingMetaData(Long.class).getSqlType();
            String objectType = objectMetaData.getSqlType();

            // The create table DDL
            StringBuffer createTableDDL = new StringBuffer("create table " + getTableName() + " (" +
                    " " + getColumnTimerID() + " varchar(80) not null," +
                    " " + getColumnTargetID() + " varchar(250) not null," +
View Full Code Here


      }

      Iterator i = typeMapping.getMappings().iterator();
      while(i.hasNext())
      {
         JDBCMappingMetaData mapping = (JDBCMappingMetaData)i.next();

         String sqlType = mapping.getSqlType();
         int jdbcType = mapping.getJdbcType();
         Class javaType = loadClass(mapping.getJavaType());
         boolean notNull = javaType.isPrimitive();
         boolean autoIncrement = false;

         JDBCParameterSetter paramSetter;
         if(mapping.getParamSetter() != null)
         {
            paramSetter = (JDBCParameterSetter)newInstance(mapping.getParamSetter());
         }
         else
         {
            paramSetter = JDBCUtil.getParameterSetter(jdbcType, javaType);
         }

         JDBCResultSetReader resultReader;
         if(mapping.getResultReader() != null)
         {
            resultReader = (JDBCResultSetReader)newInstance(mapping.getResultReader());
         }
         else
         {
            resultReader = JDBCUtil.getResultSetReader(jdbcType, javaType);
         }
View Full Code Here

               {
                  throw new IllegalStateException("Failed to create Mapper instance of " + userTypeMapping.getMapper());
               }
            }

            JDBCMappingMetaData typeMappingMD = typeMapping.getTypeMappingMetaData(javaType);
            String sqlType = typeMappingMD.getSqlType();
            int jdbcType = typeMappingMD.getJdbcType();
            boolean notNull = javaType.isPrimitive();
            boolean autoIncrement = false;

            JDBCParameterSetter paramSetter;
            if(typeMappingMD.getParamSetter() != null)
            {
               try
               {
                  paramSetter = (JDBCParameterSetter)newInstance(typeMappingMD.getParamSetter());
               }
               catch(DeploymentException e)
               {
                  throw new IllegalStateException(e.getMessage());
               }
            }
            else
            {
               paramSetter = JDBCUtil.getParameterSetter(jdbcType, javaType);
            }

            JDBCResultSetReader resultReader;
            if(typeMappingMD.getResultReader() != null)
            {
               try
               {
                  resultReader = (JDBCResultSetReader)newInstance(typeMappingMD.getResultReader());
               }
               catch(DeploymentException e)
               {
                  throw new IllegalStateException(e.getMessage());
               }
View Full Code Here

   private JDBCTypeSimple createTypeSimple(JDBCCMPFieldMetaData cmpField) throws DeploymentException
   {
      String columnName = cmpField.getColumnName();
      Class javaType = cmpField.getFieldType();

      JDBCMappingMetaData typeMappingMD = typeMapping.getTypeMappingMetaData(javaType);
      String paramSetter = typeMappingMD.getParamSetter();
      String resultReader = typeMappingMD.getResultReader();

      int jdbcType;
      String sqlType = cmpField.getSQLType();
      if(sqlType != null)
      {
         jdbcType = cmpField.getJDBCType();
      }
      else
      {
         // get jdbcType and sqlType from typeMapping
         sqlType = typeMappingMD.getSqlType();
         jdbcType = typeMappingMD.getJdbcType();
      }

      boolean notNull = cmpField.isNotNull();
      boolean autoIncrement = cmpField.isAutoIncrement();

      Mapper mapper = null;
      JDBCUserTypeMappingMetaData userTypeMapping = (JDBCUserTypeMappingMetaData)userTypeMappings.get(javaType.getName());
      if(userTypeMapping != null)
      {
         String mappedTypeStr = userTypeMapping.getMappedType();
         try
         {
            final ClassLoader contextClassLoader = TCLAction.UTIL.getContextClassLoader();
            Class mapperClass = contextClassLoader.loadClass(userTypeMapping.getMapper());
            mapper = (Mapper)mapperClass.newInstance();
            javaType = contextClassLoader.loadClass(mappedTypeStr);
            if(cmpField.getSQLType() == null)
            {
               JDBCMappingMetaData mappingMD = typeMapping.getTypeMappingMetaData(javaType);
               sqlType = mappingMD.getSqlType();
               jdbcType = mappingMD.getJdbcType();
               paramSetter = mappingMD.getParamSetter();
               resultReader = mappingMD.getResultReader();
            }
         }
         catch(ClassNotFoundException e)
         {
            throw new DeploymentException("Class not found for mapper: " + userTypeMapping.getMapper(), e);
View Full Code Here

            jdbcType = propertyMetaData.getJDBCType();
         }
         else
         {
            // get jdbcType and sqlType from typeMapping
            JDBCMappingMetaData typeMappingMD = typeMapping.getTypeMappingMetaData(javaType);
            sqlType = typeMappingMD.getSqlType();
            jdbcType = typeMappingMD.getJdbcType();
         }

         boolean notNull = propertyStack.isNotNull();

         Method[] getters = propertyStack.getGetters();
View Full Code Here

/*     */     {
/* 135 */       JDBCTypeMappingMetaData typeMapping = (JDBCTypeMappingMetaData)this.server.getAttribute(this.metaDataName, "TypeMappingMetaData");
/* 136 */       if (typeMapping == null) {
/* 137 */         throw new IllegalStateException("Cannot obtain type mapping from: " + this.metaDataName);
/*     */       }
/* 139 */       JDBCMappingMetaData objectMetaData = typeMapping.getTypeMappingMetaData(Object.class);
/* 140 */       this.binarySqlType = objectMetaData.getJdbcType();
/*     */
/* 142 */       if (!SQLUtil.tableExists(getTableName(), this.ds))
/*     */       {
/* 144 */         con = this.ds.getConnection();
/*     */
/* 146 */         String dateType = typeMapping.getTypeMappingMetaData(Timestamp.class).getSqlType();
/* 147 */         String longType = typeMapping.getTypeMappingMetaData(Long.class).getSqlType();
/* 148 */         String objectType = objectMetaData.getSqlType();
/*     */
/* 151 */         StringBuffer createTableDDL = new StringBuffer("create table " + getTableName() + " (" + " " + getColumnTimerID() + " varchar(80) not null," + " " + getColumnTargetID() + " varchar(250) not null," + " " + getColumnInitialDate() + " " + dateType + " not null," + " " + getColumnTimerInterval() + " " + longType + "," + " " + getColumnInstancePK() + " " + objectType + "," + " " + getColumnInfo() + " " + objectType + ", ");
/*     */
/* 160 */         JDBCFunctionMappingMetaData pkConstraint = typeMapping.getPkConstraintTemplate();
/* 161 */         String[] templateParams = { getTableName() + "_PK", getColumnTimerID() + ", " + getColumnTargetID() };
View Full Code Here

/*     */     }
/*     */
/* 396 */     Iterator i = typeMapping.getMappings().iterator();
/* 397 */     while (i.hasNext())
/*     */     {
/* 399 */       JDBCMappingMetaData mapping = (JDBCMappingMetaData)i.next();
/*     */
/* 401 */       String sqlType = mapping.getSqlType();
/* 402 */       int jdbcType = mapping.getJdbcType();
/* 403 */       Class javaType = loadClass(mapping.getJavaType());
/* 404 */       boolean notNull = javaType.isPrimitive();
/* 405 */       boolean autoIncrement = false;
/*     */       JDBCParameterSetter paramSetter;
/*     */       JDBCParameterSetter paramSetter;
/* 408 */       if (mapping.getParamSetter() != null)
/*     */       {
/* 410 */         paramSetter = (JDBCParameterSetter)newInstance(mapping.getParamSetter());
/*     */       }
/*     */       else
/*     */       {
/* 414 */         paramSetter = JDBCUtil.getParameterSetter(jdbcType, javaType);
/*     */       }
/*     */       JDBCResultSetReader resultReader;
/*     */       JDBCResultSetReader resultReader;
/* 418 */       if (mapping.getResultReader() != null)
/*     */       {
/* 420 */         resultReader = (JDBCResultSetReader)newInstance(mapping.getResultReader());
/*     */       }
/*     */       else
/*     */       {
/* 424 */         resultReader = JDBCUtil.getResultSetReader(jdbcType, javaType);
/*     */       }
View Full Code Here

/*     */         {
/* 466 */           throw new IllegalStateException("Failed to create Mapper instance of " + userTypeMapping.getMapper());
/*     */         }
/*     */       }
/*     */
/* 470 */       JDBCMappingMetaData typeMappingMD = this.typeMapping.getTypeMappingMetaData(javaType);
/* 471 */       String sqlType = typeMappingMD.getSqlType();
/* 472 */       int jdbcType = typeMappingMD.getJdbcType();
/* 473 */       boolean notNull = javaType.isPrimitive();
/* 474 */       boolean autoIncrement = false;
/*     */       JDBCParameterSetter paramSetter;
/* 477 */       if (typeMappingMD.getParamSetter() != null)
/*     */       {
/*     */         try
/*     */         {
/* 481 */           paramSetter = (JDBCParameterSetter)newInstance(typeMappingMD.getParamSetter());
/*     */         }
/*     */         catch (DeploymentException e)
/*     */         {
/* 485 */           throw new IllegalStateException(e.getMessage());
/*     */         }
/*     */       }
/*     */       else
/*     */       {
/* 490 */         paramSetter = JDBCUtil.getParameterSetter(jdbcType, javaType);
/*     */       }
/*     */       JDBCResultSetReader resultReader;
/* 494 */       if (typeMappingMD.getResultReader() != null)
/*     */       {
/*     */         try
/*     */         {
/* 498 */           resultReader = (JDBCResultSetReader)newInstance(typeMappingMD.getResultReader());
/*     */         }
/*     */         catch (DeploymentException e)
/*     */         {
/* 502 */           throw new IllegalStateException(e.getMessage());
/*     */         }
View Full Code Here

/*     */   private JDBCTypeSimple createTypeSimple(JDBCCMPFieldMetaData cmpField) throws DeploymentException
/*     */   {
/* 559 */     String columnName = cmpField.getColumnName();
/* 560 */     Class javaType = cmpField.getFieldType();
/*     */
/* 562 */     JDBCMappingMetaData typeMappingMD = this.typeMapping.getTypeMappingMetaData(javaType);
/* 563 */     String paramSetter = typeMappingMD.getParamSetter();
/* 564 */     String resultReader = typeMappingMD.getResultReader();
/*     */
/* 567 */     String sqlType = cmpField.getSQLType();
/*     */     int jdbcType;
/*     */     int jdbcType;
/* 568 */     if (sqlType != null)
/*     */     {
/* 570 */       jdbcType = cmpField.getJDBCType();
/*     */     }
/*     */     else
/*     */     {
/* 575 */       sqlType = typeMappingMD.getSqlType();
/* 576 */       jdbcType = typeMappingMD.getJdbcType();
/*     */     }
/*     */
/* 579 */     boolean notNull = cmpField.isNotNull();
/* 580 */     boolean autoIncrement = cmpField.isAutoIncrement();
/*     */
/* 582 */     Mapper mapper = null;
/* 583 */     JDBCUserTypeMappingMetaData userTypeMapping = (JDBCUserTypeMappingMetaData)this.userTypeMappings.get(javaType.getName());
/* 584 */     if (userTypeMapping != null)
/*     */     {
/* 586 */       String mappedTypeStr = userTypeMapping.getMappedType();
/*     */       try
/*     */       {
/* 589 */         ClassLoader contextClassLoader = TCLAction.UTIL.getContextClassLoader();
/* 590 */         Class mapperClass = contextClassLoader.loadClass(userTypeMapping.getMapper());
/* 591 */         mapper = (Mapper)mapperClass.newInstance();
/* 592 */         javaType = contextClassLoader.loadClass(mappedTypeStr);
/* 593 */         if (cmpField.getSQLType() == null)
/*     */         {
/* 595 */           JDBCMappingMetaData mappingMD = this.typeMapping.getTypeMappingMetaData(javaType);
/* 596 */           sqlType = mappingMD.getSqlType();
/* 597 */           jdbcType = mappingMD.getJdbcType();
/* 598 */           paramSetter = mappingMD.getParamSetter();
/* 599 */           resultReader = mappingMD.getResultReader();
/*     */         }
/*     */       }
/*     */       catch (ClassNotFoundException e)
/*     */       {
/* 604 */         throw new DeploymentException("Class not found for mapper: " + userTypeMapping.getMapper(), e);
View Full Code Here

/*     */       {
/* 773 */         jdbcType = propertyMetaData.getJDBCType();
/*     */       }
/*     */       else
/*     */       {
/* 778 */         JDBCMappingMetaData typeMappingMD = this.typeMapping.getTypeMappingMetaData(javaType);
/* 779 */         sqlType = typeMappingMD.getSqlType();
/* 780 */         jdbcType = typeMappingMD.getJdbcType();
/*     */       }
/*     */
/* 783 */       boolean notNull = propertyStack.isNotNull();
/*     */
/* 785 */       Method[] getters = propertyStack.getGetters();
View Full Code Here

TOP

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

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.