public void setDiscriminator (Discriminator discriminator) { if (this.discriminator != null) { throw new SqlMapException ("A discriminator may only be set once per result map."); } this.discriminator = discriminator; }
public void setDiscriminator (Discriminator discriminator) { if (this.discriminator != null) { throw new SqlMapException ("A discriminator may only be set once per result map."); } this.discriminator = discriminator; }
/** * Get a mappedstatement by its ID * * @param id - the statement ID * @return - the mapped statement */ public MappedStatement getMappedStatement(String id) { MappedStatement ms = (MappedStatement) mappedStatements.get(id); if (ms == null) { throw new SqlMapException("There is no statement named " + id + " in this SqlMap."); } return ms; }
/** * Get a cache model by ID * * @param id - the ID * @return - the cache model */ public CacheModel getCacheModel(String id) { CacheModel model = (CacheModel) cacheModels.get(id); if (model == null) { throw new SqlMapException("There is no cache model named " + id + " in this SqlMap."); } return model; }
/** * Get a parameter map by ID * * @param id - the ID * @return - the parameter map */ public ParameterMap getParameterMap(String id) { ParameterMap map = (ParameterMap) parameterMaps.get(id); if (map == null) { throw new SqlMapException("There is no parameter map named " + id + " in this SqlMap."); } return map; }
/** * Get a cache model by ID * * @param id - the ID * @return - the cache model */ public CacheModel getCacheModel(String id) { CacheModel model = (CacheModel) cacheModels.get(id); if (model == null) { throw new SqlMapException("There is no cache model named " + id + " in this SqlMap."); } return model; }
/** * Get a parameter map by ID * * @param id - the ID * @return - the parameter map */ public ParameterMap getParameterMap(String id) { ParameterMap map = (ParameterMap) parameterMaps.get(id); if (map == null) { throw new SqlMapException("There is no parameter map named " + id + " in this SqlMap."); } return map; }
/** * Get a result map by ID * * @param id - the ID * @return - the result map */ public ResultMap getResultMap(String id) { ResultMap map = (ResultMap) resultMaps.get(id); if (map == null) { throw new SqlMapException("There is no result map named " + id + " in this SqlMap."); } return map; }
/** * Get a result map by ID * * @param id - the ID * @return - the result map */ public ResultMap getResultMap(String id) { ResultMap map = (ResultMap) resultMaps.get(id); if (map == null) { throw new SqlMapException("There is no result map named " + id + " in this SqlMap."); } return map; }
/** * Get a mappedstatement by its ID * * @param id - the statement ID * @return - the mapped statement */ public MappedStatement getMappedStatement(String id) { MappedStatement ms = (MappedStatement) mappedStatements.get(id); if (ms == null) { throw new SqlMapException("There is no statement named " + id + " in this SqlMap."); } return ms; }
/** * Gets a MemoryCacheLevel by name * * @param refType the name of the reference type * @return the MemoryCacheLevel that the name indicates */ public static MemoryCacheLevel getByReferenceType(String refType) { MemoryCacheLevel cacheLevel = (MemoryCacheLevel) cacheLevelMap.get(refType); if (cacheLevel == null) { throw new SqlMapException("Error getting CacheLevel (reference type) for name: '" + refType + "'."); } return cacheLevel; } }
/** * Gets a MemoryCacheLevel by name * * @param refType the name of the reference type * @return the MemoryCacheLevel that the name indicates */ public static MemoryCacheLevel getByReferenceType(String refType) { MemoryCacheLevel cacheLevel = (MemoryCacheLevel) cacheLevelMap.get(refType); if (cacheLevel == null) { throw new SqlMapException("Error getting CacheLevel (reference type) for name: '" + refType + "'."); } return cacheLevel; } }
public static Date format(String format, String datetime) { try { return new SimpleDateFormat(format).parse(datetime); } catch (ParseException e) { throw new SqlMapException("Error parsing default null value date. Format must be '" + format + "'. Cause: " + e); } }
public void setProperties(Properties props) throws SQLException, TransactionException { String utxName = null; try { utxName = (String) props.get("UserTransaction"); InitialContext initCtx = new InitialContext(); userTransaction = (UserTransaction) initCtx.lookup(utxName); } catch (NamingException e) { throw new SqlMapException("Error initializing JtaTransactionConfig while looking up UserTransaction (" + utxName + "). Cause: " + e); } }
public static Date format(String format, String datetime) { try { return new SimpleDateFormat(format).parse(datetime); } catch (ParseException e) { throw new SqlMapException("Error parsing default null value date. Format must be '" + format + "'. Cause: " + e); } }
public void setProperties(Properties props) throws SQLException, TransactionException { String utxName = null; try { utxName = (String) props.get("UserTransaction"); InitialContext initCtx = new InitialContext(); userTransaction = (UserTransaction) initCtx.lookup(utxName); } catch (NamingException e) { throw new SqlMapException("Error initializing JtaTransactionConfig while looking up UserTransaction (" + utxName + "). Cause: " + e); } }
/** * Adds a type alias that is case insensitive. All of the following String, string, StRiNg will equate to the same alias. * @param alias - the alias * @param value - the real class name */ public void putTypeAlias(String alias, String value) { String key = null; if(alias != null) key = alias.toLowerCase(); if (typeAliases.containsKey(key) && !typeAliases.get(key).equals(value)) { throw new SqlMapException("Error in XmlSqlMapClientBuilder. Alias name conflict occurred. The alias '" + key + "' is already mapped to the value '" + typeAliases.get(alias) + "'."); } typeAliases.put(key, value); }
/** * Adds a type alias that is case insensitive. All of the following String, string, StRiNg will equate to the same alias. * @param alias - the alias * @param value - the real class name */ public void putTypeAlias(String alias, String value) { String key = null; if(alias != null) key = alias.toLowerCase(); if (typeAliases.containsKey(key) && !typeAliases.get(key).equals(value)) { throw new SqlMapException("Error in XmlSqlMapClientBuilder. Alias name conflict occurred. The alias '" + key + "' is already mapped to the value '" + typeAliases.get(alias) + "'."); } typeAliases.put(key, value); }
public void setDefaultStatementTimeout(Integer defaultTimeout) { errorContext.setActivity("setting default timeout"); if (defaultTimeout != null) { try { defaultStatementTimeout = defaultTimeout; } catch (NumberFormatException e) { throw new SqlMapException("Specified defaultStatementTimeout is not a valid integer"); } } }
public void setJavaTypeName(String javaTypeName) { try { if (javaTypeName == null) { this.javaType = null; } else { this.javaType = Resources.classForName(javaTypeName); } } catch (ClassNotFoundException e) { throw new SqlMapException("Error setting javaType property of ParameterMap. Cause: " + e, e); } }