Create XA properties.

@param databaseType database type
@return XA properties
970901
public static XAProperties createXAProperties(final DatabaseType databaseType) {
        switch (databaseType) {
            case H2:
                return new H2XAProperties();
            case MySQL:
                return new MySQLXAProperties();
            case PostgreSQL:
                return new PostgreSQLXAProperties();
            case Oracle:
                return new OracleXAProperties();
            case SQLServer:
                return new SQLServerXAProperties();
            default:
                throw new UnsupportedOperationException(String.format("Cannot support database type: `%s`", databaseType));
        }
    }
91722
public static <T> DatabaseTableConfig<T> fromClass(DatabaseType databaseType, Class<T> clazz) throws SQLException {
		String tableName = extractTableName(databaseType, clazz);
		if (databaseType.isEntityNamesMustBeUpCase()) {
			tableName = databaseType.upCaseEntityName(tableName);
		}
		return new DatabaseTableConfig<T>(databaseType, clazz, tableName,
				extractFieldTypes(databaseType, clazz, tableName));
	}
293556
private Map<String, String> getPoolingProperties(DBType aDbType) {
        Map<String, String> retMap = new HashMap<>();

        //general properties
        //acquire increment size
        String acqIncSize = this.getPropStringValue(CONNECTION_ACQUIREINCREMENT_SIZE_NAME,
                CONNECTION_ACQUIREINCREMENT_SIZE_DEFAULT_VALUE);
        retMap.put(C3P0_ACQUIRE_INCREMENT_NAME, acqIncSize);

        //retry counts
        String retryCount = this.getPropStringValue(CONNECTION_RETRY_COUNT_NAME,
                CONNECTION_RETRY_COUNT_DEFAULT_VALUE);
        retMap.put(C3P0_ACQUIRE_RETRY_ATTEMPTS_NAME, retryCount);

        //retry deplay this will be value of milseconds
        String retryDelay = this.getPropStringValue(CONNECTION_RETRY_DELAY_NAME,
                CONNECTION_RETRY_DELAY_DEFAULT_VALUE);
        retMap.put(C3P0_ACQUIRE_RETRY_DELAY_NAME, retryDelay);

        //test period
        String testPeriod = this.getPropStringValue(CONNECTION_TEST_PERIOD_NAME,
                CONNECTION_TEST_PERIOD_DEFAULT_VALUE);
        retMap.put(C3P0_IDLE_CONNECTION_TEST_PERIOD_NAME, testPeriod);

        //test on check in
        String bTestOnCheckIn = this.getPropStringValue(CONNECTION_TEST_ONCHECKIN_NAME,
                CONNECTION_TEST_ONCHECKIN_DEFAULT_VALUE);
        retMap.put(C3P0_TEST_CONNECTION_ON_CHECKIN_NAME, bTestOnCheckIn);

        //test on check out
        String bTestOnCheckOut = this.getPropStringValue(CONNECTION_TEST_ONCHECKOUT_NAME,
                CONNECTION_TEST_ONCHECKOUT_DEFAULT_VALUE);
        retMap.put(C3P0_TEST_CONNECTION_ON_CHECKOUT_NAME, bTestOnCheckOut);

        //max idle time
        String maxIdleTime = this.getPropStringValue(CONNECTION_MAX_IDLETIME_NAME,
                CONNECTION_MAX_IDLETIME_DEFAULT_VALUE);
        retMap.put(C3P0_MAX_IDLE_TIME_NAME, maxIdleTime);

        //max pool size
        String maxPoolSize = this.getPropStringValue(MAX_POOL_SIZE_NAME,
                MAX_POOL_SIZE_DEFAULT_VALUE);

        retMap.put(C3P0_MAX_POOL_SIZE_NAME, maxPoolSize);

        //min pool size
        String minPoolSize = this.getPropStringValue(MIN_POOL_SIZE_NAME,
                MIN_POOL_SIZE_DEFAULT_VALUE);

        retMap.put(C3P0_MIN_POOL_SIZE_NAME, minPoolSize);

        //init pool size
        String initPoolSize = this.getPropStringValue(INIT_POOL_SIZE_NAME,
                INIT_POOL_SIZE_DEFAULT_VALUE);

        retMap.put(C3P0_INIT_POOL_SIZE_NAME, initPoolSize);

        //connection timeout
        String conTimeout = this.getPropStringValue(CONNECTION_CHECKOUT_TIMEOUT_NAME,
                CONNECTION_CHECKOUT_TIMEOUT_DEFAULT_VALUE);
        retMap.put(C3P0_CHECKOUT_TIMEOUT_NAME, conTimeout);

        //connection break after acquire failure
        String breakAfterFailure = this.getPropStringValue(CONNECTION_BREAKAFTERACQUIREFAILURE_NAME,
                CONNECTION_BREAKAFTERACQUIREFAILURE_DEFAULT_VALUE);
        retMap.put(C3P0_BREAK_AFTERACQUIREFAILURE_NAME, breakAfterFailure);

        //db specific properties
        //connection life time
        String conLifeTimeName;

        switch (aDbType) {
            case ORACLE:
                conLifeTimeName = ORACLE_CONNECTION_LIFETIME_NAME;
                break;
            case MSSQL:
                conLifeTimeName = MSSQL_CONNECTION_LIFETIME_NAME;
                break;
            case MYSQL:
                conLifeTimeName = MYSQL_CONNECTION_LIFETIME_NAME;
                break;
            case SYBASE:
                conLifeTimeName = SYBASE_CONNECTION_LIFETIME_NAME;
                break;
            case DB2:
                conLifeTimeName = DB2_CONNECTION_LIFETIME_NAME;
                break;
            case NETCOOL:
                conLifeTimeName = NETCOOL_CONNECTION_LIFETIME_NAME;
                break;
            default:
                conLifeTimeName = CUSTOM_CONNECTION_LIFETIME_NAME;
                break;
        }

        String connectionLifetime =
                this.getPropStringValue(conLifeTimeName, CONNECTION_LIFETIME_DEFAULT_VALUE);

        retMap.put(C3P0_MAX_CONNECTION_AGE_NAME, connectionLifetime);


        return retMap;
    }
243154
private void createProperties(ClassName vueFactoryType, Builder vueFactoryBuilder) {
    vueFactoryBuilder.addField(FieldSpec
        .builder(vueFactoryType, INSTANCE_PROP, Modifier.PRIVATE, Modifier.STATIC)
        .build());
  }
513135
public Database getDatabase(String strDBName, int iDatabaseType, Map<String, Object> properties)
    {
        return m_databaseCollection.getDatabase(strDBName, iDatabaseType, properties);
    }
947742
public boolean create(String strDatabaseName) throws DBException
    {
        try {
            String strDBName = this.getProperty(SQLParams.INTERNAL_DB_NAME);
            int iDatabaseType = DBConstants.SYSTEM_DATABASE;
            DatabaseOwner env = this.getDatabaseOwner();
            JdbcDatabase db = (JdbcDatabase)env.getDatabase(strDBName, iDatabaseType, null);    // Do NOT pass properties when opening system database
            Statement queryStatement = db.getJDBCConnection().createStatement();

            String strSQL = "create database " + strDatabaseName + ";";
            queryStatement.execute(strSQL);
            queryStatement.close();
            db.free();

            String oldValue = this.getProperty(DBConstants.CREATE_DB_IF_NOT_FOUND);
            this.setProperty(DBConstants.CREATE_DB_IF_NOT_FOUND, DBConstants.FALSE);
            
            this.close();   // Since I don't know what kind of connection this is.
            this.setupDBConnection();

            this.setProperty(DBConstants.CREATE_DB_IF_NOT_FOUND, oldValue);
            
            if (this.getProperty(DBConstants.LOAD_INITIAL_DATA) != null)
            	if ((this.getDatabaseType() & (DBConstants.SHARED_DATA | DBConstants.USER_DATA)) == DBConstants.SHARED_DATA)	// Yes, only shared data can have DatabaseInfo
            {
                DatabaseInfo recDatabaseInfo = new DatabaseInfo();
                try {
                	recDatabaseInfo.setDatabaseName(this.getDatabaseName(false));
                	recDatabaseInfo.setTable(this.doMakeTable(recDatabaseInfo));    // This makes a jdbc table
                	recDatabaseInfo.init(null); // This should create the table if an archive exists
                } catch (Exception ex) {
                	// Ignore
                } finally {
                	recDatabaseInfo.free();
                }
            }
            return true;    // Success
        } catch (SQLException ex) {
            ex.printStackTrace();
        }

        return super.create(strDatabaseName);   // Error, not found
    }
1269617
public boolean create() throws DBException
    {
        boolean bSuccess = true;
        this.setResultSet(null, DBConstants.SQL_CREATE_TYPE);
        ResultSet resultSet = (ResultSet)this.getResultSet();
        if (resultSet == null)
        {
            Map<String,Object> properties = this.getDatabase().getProperties();
            String strAltSecondaryIndex = (String)this.getDatabase().getProperties().get(SQLParams.ALT_SECONDARY_INDEX);
            try   {
                int iFirstIndex = 0;
                Record record = this.getRecord();
                StringBuilder sql = new StringBuilder();
                sql.append("CREATE TABLE ");
                sql.append(record.makeTableNames(true));
                sql.append(" (");
                for (int iIndex = 0; iIndex < record.getFieldCount(); iIndex++)
                {
                    BaseField field = record.getField(iIndex);
                    if (field.isVirtual())
                        continue;
                    String strType = field.getSQLType(true, properties);
                    if (field instanceof CounterField)
                        if (this.getDatabase().isAutosequenceSupport())
                        {
                            String strCounterType = (String)this.getDatabase().getProperties().get(SQLParams.AUTO_SEQUENCE_TYPE);
                            if (strCounterType != null)
                                strType = strCounterType;
                            String strAutoseqExtra = (String)this.getDatabase().getProperties().get(SQLParams.AUTO_SEQUENCE_EXTRA);
                            if (strAutoseqExtra != null)
                                strType += strAutoseqExtra;
                            String strCounterExtra = (String)this.getDatabase().getProperties().get(SQLParams.COUNTER_EXTRA);
                            if (strCounterExtra != null)
                            {
                                strType += strCounterExtra;
                                iFirstIndex = 1;    // No need to build primary index
                            }
                        }
                    if (iIndex > 0)
                        sql.append(", ");
                    if (DBConstants.TRUE.equals(this.getDatabase().getProperties().get(SQLParams.NO_NULL_KEY_SUPPORT)))
                        this.checkNullableKey(field, strAltSecondaryIndex != null); // Set the key to not nullable for create.
                    if (!field.isNullable())
                    	if (!DBConstants.TRUE.equals(this.getDatabase().getProperties().get(SQLParams.NO_NULL_FIELD_SUPPORT)))	// Rare (or for locale dbs)
                    		strType += " NOT NULL";
                    if (strAltSecondaryIndex != null)
                        if (this.checkIndexField(field))
                            strType += ' ' + strAltSecondaryIndex;
                    sql.append(field.getFieldName(true, false)).append(' ').append(strType);
                }
                String strPrimaryKey = (String)this.getDatabase().getProperties().get(SQLParams.AUTO_SEQUENCE_PRIMARY_KEY);
                if (strPrimaryKey != null)
                    if (record.getCounterField() != null)
                        if (this.getDatabase().isAutosequenceSupport())
                {
                    sql.append(", ").append(strPrimaryKey).append(" (").append(record.getCounterField().getFieldName(true, false)).append(")");
                    iFirstIndex = 1;    // No need to build primary index
                }
                sql.append(")");
                Utility.getLogger().info(sql.toString());
                if (DBConstants.TRUE.equals((String)this.getDatabase().getProperties().get(SQLParams.NO_PREPARED_STATEMENTS_ON_CREATE)))
                    this.setStatement(null, DBConstants.SQL_CREATE_TYPE);
                if (this.getStatement(DBConstants.SQL_CREATE_TYPE) == null)
                    this.setStatement(((JdbcDatabase)this.getDatabase()).getJDBCConnection().createStatement(), DBConstants.SQL_CREATE_TYPE);
                this.getStatement(DBConstants.SQL_CREATE_TYPE).execute(sql.toString());
                // Now set up the index(es)
                sql = new StringBuilder();
                String strPrimaryKeySQL = (String)this.getDatabase().getProperties().get(SQLParams.CREATE_PRIMARY_INDEX);
                if (strPrimaryKeySQL == null)   // null=use default, If empty string, not supported.
                    strPrimaryKeySQL = "CREATE ${unique} INDEX ${keyname} ON ${table} (${fieldsandorder})";    // Default
                String strCreateIndexSQL = (String)this.getDatabase().getProperties().get(SQLParams.CREATE_INDEX);
                if (strCreateIndexSQL == null)   // null=use default, If empty string, not supported.
                    strCreateIndexSQL = strPrimaryKeySQL;    // Default
                for (int iIndex = iFirstIndex; iIndex < record.getKeyAreaCount(); iIndex++)
                {
                    KeyArea keyArea = record.getKeyArea(iIndex);
                    if ((keyArea.getUniqueKeyCode() == DBConstants.UNIQUE)
                        && (iIndex == iFirstIndex)
                            && (keyArea.getKeyFields() == 1))
                        sql = new StringBuilder(strPrimaryKeySQL);
                    else
                        sql = new StringBuilder(strCreateIndexSQL);
                    if (sql.length() == 0)
                        continue;   // Not supported.
                    boolean indexCanBeUnique = true;
                	if (DBConstants.TRUE.equals(this.getDatabase().getProperties().get(SQLParams.NO_NULL_UNIQUE_KEYS)))
                        if (iIndex > 0)
                    {	// This db considers null a valid index value and will throw a unique key error on write
                        for (int iFieldIndex = 0; iFieldIndex < keyArea.getKeyFields(); iFieldIndex++)
                        {
                            KeyField keyField = keyArea.getKeyField(iFieldIndex);
                            BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA);
                            if (field.isNullable())
                            	indexCanBeUnique = false;
                        }
                    }
                    if (iIndex > 0)
                    	if (DBConstants.TRUE.equals(this.getDatabase().getProperties().get(SQLParams.NO_NULL_FIELD_SUPPORT)))	// Rare (or for locale dbs)
                    		indexCanBeUnique = false;
                    
                    if ((keyArea.getUniqueKeyCode() == DBConstants.UNIQUE) && (indexCanBeUnique))
                        sql = Utility.replace(sql, "${unique}", "UNIQUE");
                    else
                        sql = Utility.replace(sql, "${unique}", DBConstants.BLANK);
                    String strKeyName = keyArea.getKeyName();
                    String strTableNames = record.makeTableNames(true);
                    if (DBConstants.TRUE.equals(this.getDatabase().getProperties().get(SQLParams.NO_DUPLICATE_KEY_NAMES)))
                    {
                    	if (strTableNames.endsWith("_temp"))
                    		strKeyName = strTableNames.substring(0, strTableNames.length() - 5) + "_" + strKeyName;
                    	else
                    		strKeyName = strTableNames + "_" + strKeyName;
                    }
                    String strMaxKeyNameLength = (String)this.getDatabase().getProperties().get(SQLParams.MAX_KEY_NAME_LENGTH);
                    if (strMaxKeyNameLength != null)
                    {
                        int iMaxKeyNameLength = Integer.parseInt(strMaxKeyNameLength);
                        if (strKeyName.length() > iMaxKeyNameLength)
                        {
                        	strKeyName = strKeyName + (int)(Math.random() * 100000);
                            strKeyName = strKeyName.substring(strKeyName.length() - iMaxKeyNameLength);
                            while (!Character.isLetter(strKeyName.charAt(0))) {
                            	strKeyName = strKeyName.substring(1);
                            }
                        }
                    }
                    sql = Utility.replace(sql, "${keyname}", strKeyName);
                    sql = Utility.replace(sql, "${table}", strTableNames);
                    String strFields = DBConstants.BLANK;
                    String strFieldAndOrder = DBConstants.BLANK;
                    for (int iFieldIndex = 0; iFieldIndex < keyArea.getKeyFields(); iFieldIndex++)
                    {
                        KeyField keyField = keyArea.getKeyField(iFieldIndex);
                        BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA);
                        if (iFieldIndex > 0)
                        {
                            strFields += ", ";
                            strFieldAndOrder += ", ";
                        }
                        strFields += field.getFieldName(true, false) + " ";
                        strFieldAndOrder += field.getFieldName(true, false) + " ";
                        if (keyField.getKeyOrder() == DBConstants.DESCENDING)
                            strFieldAndOrder += "DESC ";
                    }
                    sql = Utility.replace(sql, "${fields}", strFields);
                    sql = Utility.replace(sql, "${fieldsandorder}", strFieldAndOrder);
                    Utility.getLogger().info(sql.toString());
                    this.getStatement(DBConstants.SQL_CREATE_TYPE).execute(sql.toString());
                }
            } catch (SQLException e)    {
                throw this.getDatabase().convertError(e);
            } finally {
                if (DBConstants.TRUE.equals(this.getDatabase().getProperties().get(SQLParams.NO_PREPARED_STATEMENTS_ON_CREATE)))
                    this.setStatement(null, DBConstants.SQL_CREATE_TYPE);
            }
        }
        this.setResultSet(null, DBConstants.SQL_CREATE_TYPE);
        return bSuccess;    // Success!!!
    }
178165
public Map<String,String> getDatabaseProperties()
    {
        String strDatabaseProductName = this.getProperty(SQLParams.INTERNAL_DB_NAME);
        if (strDatabaseProductName == null)
            return null;    // Can't get the properties without the database being used
        Map<String,String> map = super.getDatabaseProperties();        
        strDatabaseProductName = strDatabaseProductName.toLowerCase();
        ResourceBundle dbProperties = null;
        if (strDatabaseProductName.indexOf("access") != -1)
            dbProperties = new DBProperties_access();
        else if (strDatabaseProductName.indexOf("instantdb") != -1)
            dbProperties = new DBProperties_instantdb();
        else if (strDatabaseProductName.indexOf("sybase") != -1)
            dbProperties = new DBProperties_sybase();
        else if (strDatabaseProductName.indexOf("pointBase") != -1)
            dbProperties = new DBProperties_pointbase();
        else if (strDatabaseProductName.indexOf("mysql") != -1)
            dbProperties = new DBProperties_mysql();
        else if (strDatabaseProductName.indexOf("postgresql") != -1)
            dbProperties = new DBProperties_postgresql();
        else
        {
            if (strDatabaseProductName.indexOf('.') == -1)
            {
                String strClassName = DBProperties_mysql.class.getName();
                strDatabaseProductName = strClassName.substring(0, strClassName.length() - "mysql".length()) + strDatabaseProductName;
            }
//            dbProperties = (ListResourceBundle)ThinUtil.getClassService().makeObjectFromClassName(Object.class.getName(), strDatabaseProductName);

            
            
           try {
        	   Class<?> c = Class.forName(strDatabaseProductName);
        	   dbProperties = (ListResourceBundle)c.newInstance();
           } catch (Exception e) {
    		   Utility.getLogger().warning("Error on create class: " + strDatabaseProductName);
    		   e.printStackTrace();
           }
           
        }
        // Merge the properties with my properties.
        if (dbProperties != null)
        {
            if (map == null)
                map = new HashMap<String,String>();
            for (Enumeration<String> e = dbProperties.getKeys() ; e.hasMoreElements() ;)
            {
                String key = e.nextElement();
                String value = dbProperties.getString(key);
                map.put(key, value);
            }
        }
        
        return map;
    }
424060
private DBService createTenantDBService(Tenant tenant) {
        m_logger.info("Creating DBService for tenant: {}", tenant.getName());
        Map<String, Object> dbServiceParams = tenant.getDefinition().getOptionMap("DBService");
        String dbServiceName = null;
        if (dbServiceParams == null || !dbServiceParams.containsKey("dbservice")) {
            dbServiceName = ServerParams.instance().getModuleParamString("DBService", "dbservice");
            Utils.require(!Utils.isEmpty(dbServiceName), "DBService.dbservice parameter is not defined");
        } else {
            dbServiceName = dbServiceParams.get("dbservice").toString();
        }

        DBService dbservice = null;
        try {
            @SuppressWarnings("unchecked")
            Class<DBService> serviceClass = (Class<DBService>) Class.forName(dbServiceName);
            Constructor<DBService> constructor = serviceClass.getConstructor(Tenant.class);
            dbservice = constructor.newInstance(tenant);
            dbservice.initialize();
            dbservice.start();
        } catch (IllegalArgumentException e) {
            throw new RuntimeException("Cannot load specified 'dbservice': " + dbServiceName, e);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException("Could not load dbservice class '" + dbServiceName + "'", e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException("Required constructor missing for dbservice class: " + dbServiceName, e);
        } catch (SecurityException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
            throw new RuntimeException("Could not invoke constructor for dbservice class: " + dbServiceName, e);
        } catch (Throwable e) {
            throw new RuntimeException("Failed to initialize DBService '" + dbServiceName +
                                       "' for tenant: " + tenant.getName(), e);
        }
        return dbservice;
    }
735102
private static DatabaseType getDatabaseType(String dbtype) {
    if (dbtype.equals("h2"))
      return DatabaseType.H2;
    else if (dbtype.equals("oracle"))
      return DatabaseType.ORACLE;
    else if (dbtype.equals("mysql"))
      return DatabaseType.MYSQL;
    else
      throw new DukeConfigException("Unknown database type: '" + dbtype + "'");
  }
1286453
public <T> T createInstance(DatastoreType datastoreType, DynamicType<?> types) {
        return newInstance(getDatastoreId(datastoreType), datastoreType, types, TransactionalCache.Mode.WRITE);
    }
1300028
public void init(DatabaseOwner databaseOwner, String strDbName, int iDatabaseType, Map<String, Object> properties)
    {
        super.init(databaseOwner, strDbName, iDatabaseType, properties);

        if ((iDatabaseType & Constants.REMOTE_MEMORY) == 0)
        {   // Usually don't send messages (unless this is a remote copy, then I would)
            this.setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.FALSE);   // Send by server version
            this.setProperty(DBParams.CREATE_REMOTE_FILTER, DBConstants.FALSE); // Create the remote filter
            this.setProperty(DBParams.UPDATE_REMOTE_FILTER, DBConstants.FALSE); // Updated by server version
        }
    }
825915
public XADataSource createXADataSource(Properties props) throws SQLException {
        if (props == null) props = new Properties();
        XADataSource dataSource = newXADataSource();
        setBeanProperties(dataSource, props);
        return dataSource;
    }
189202
public static SQLExecuteCallback<Boolean> getPreparedSQLExecuteCallback(final DatabaseType databaseType, final boolean isExceptionThrown) {
        return new SQLExecuteCallback<Boolean>(databaseType, isExceptionThrown) {
            
            @Override
            protected Boolean executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException {
                return ((PreparedStatement) statement).execute();
            }
        };
    }
926976
public static AbstractDeleteParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) {
        switch (dbType) {
            case H2:
            case MySQL:
                return new MySQLDeleteParser(shardingRule, lexerEngine);
            case Oracle:
                return new OracleDeleteParser(shardingRule, lexerEngine);
            case SQLServer:
                return new SQLServerDeleteParser(shardingRule, lexerEngine);
            case PostgreSQL:
                return new PostgreSQLDeleteParser(shardingRule, lexerEngine);
            default:
                throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
        }
    }
251424
private void assignDataType(DatabaseType databaseType, DataPersister dataPersister) throws SQLException {
		dataPersister = databaseType.getDataPersister(dataPersister, this);
		this.dataPersister = dataPersister;
		if (dataPersister == null) {
			if (!fieldConfig.isForeign() && !fieldConfig.isForeignCollection()) {
				// may never happen but let's be careful out there
				throw new SQLException("Data persister for field " + this
						+ " is null but the field is not a foreign or foreignCollection");
			}
			return;
		}
		this.fieldConverter = databaseType.getFieldConverter(dataPersister, this);
		if (this.isGeneratedId && !dataPersister.isValidGeneratedType()) {
			StringBuilder sb = new StringBuilder();
			sb.append("Generated-id field '").append(field.getName());
			sb.append("' in ").append(field.getDeclaringClass().getSimpleName());
			sb.append(" can't be type ").append(dataPersister.getSqlType());
			sb.append(".  Must be one of: ");
			for (DataType dataType : DataType.values()) {
				DataPersister persister = dataType.getDataPersister();
				if (persister != null && persister.isValidGeneratedType()) {
					sb.append(dataType).append(' ');
				}
			}
			throw new IllegalArgumentException(sb.toString());
		}
		if (fieldConfig.isThrowIfNull() && !dataPersister.isPrimitive()) {
			throw new SQLException("Field " + field.getName() + " must be a primitive if set with throwIfNull");
		}
		if (this.isId && !dataPersister.isAppropriateId()) {
			throw new SQLException("Field '" + field.getName() + "' is of data type " + dataPersister
					+ " which cannot be the ID field");
		}
		this.dataTypeConfigObj = fieldConverter.makeConfigObject(this);
		String defaultStr = fieldConfig.getDefaultValue();
		if (defaultStr == null) {
			this.defaultValue = null;
		} else if (this.isGeneratedId) {
			throw new SQLException("Field '" + field.getName() + "' cannot be a generatedId and have a default value '"
					+ defaultStr + "'");
		} else {
			this.defaultValue = this.fieldConverter.parseDefaultString(this, defaultStr);
		}
	}
9514
public static int getTypeValForSqlType(SqlType sqlType) throws SQLException {
		int[] typeVals = typeToValMap.get(sqlType);
		if (typeVals == null) {
			throw new SQLException("SqlType is unknown to type val mapping: " + sqlType);
		}
		if (typeVals.length == 0) {
			throw new SQLException("SqlType does not have any JDBC type value mapping: " + sqlType);
		} else {
			return typeVals[0];
		}
	}