List of usage examples for org.springframework.dao TypeMismatchDataAccessException TypeMismatchDataAccessException
public TypeMismatchDataAccessException(String msg)
From source file:com._4dconcept.springframework.data.marklogic.repository.query.MarklogicQueryCreator.java
@Override protected Criteria create(Part part, Iterator<Object> iterator) { PersistentPropertyPath<MarklogicPersistentProperty> path = context .getPersistentPropertyPath(part.getProperty()); MarklogicPersistentProperty property = path.getLeafProperty(); if (property == null) { throw new TypeMismatchDataAccessException( String.format("No persistent pntity information found for the path %s", path)); }//from ww w .ja v a 2s . c o m return from(part, property, iterator); }
From source file:com.gzj.tulip.jade.rowmapper.MapEntryRowMapper.java
@Override public Object mapRow(ResultSet rs, int rowNum) throws SQLException { if (rowNum == 0) { if (StringUtils.isNotEmpty(keyColumn)) { keyColumnIndex = rs.findColumn(keyColumn); if (keyColumnIndex <= 0) { throw new IllegalArgumentException( String.format("wrong key name %s for method: %s ", keyColumn, modifier.getMethod())); }//from w ww .ja v a 2 s . c om keyColumn = null; } if (logger.isDebugEnabled()) { logger.debug(String.format("keyIndex=%s; for method: %s ", keyColumnIndex, modifier.getMethod())); } } // JDBC ResultSet ? Key Object key = JdbcUtils.getResultSetValue(rs, keyColumnIndex, keyType); if (key != null && !keyType.isInstance(key)) { ResultSetMetaData rsmd = rs.getMetaData(); throw new TypeMismatchDataAccessException( // NL "Type mismatch affecting row number " + rowNum + " and column type '" + rsmd.getColumnTypeName(keyColumnIndex) + "' expected type is '" + keyType + "'"); } return new MapEntryImpl<Object, Object>(key, mapper.mapRow(rs, rowNum)); }
From source file:com.sinosoft.one.data.jade.rowmapper.MapEntryRowMapper.java
public Object mapRow(ResultSet rs, int rowNum) throws SQLException { if (rowNum == 0) { if (StringUtils.isNotEmpty(keyColumn)) { keyColumnIndex = rs.findColumn(keyColumn); if (keyColumnIndex <= 0) { throw new IllegalArgumentException( String.format("wrong key name %s for method: %s ", keyColumn, modifier.getMethod())); }//from w w w . j a v a 2 s .c o m keyColumn = null; } if (logger.isDebugEnabled()) { logger.debug(String.format("keyIndex=%s; for method: %s ", keyColumnIndex, modifier.getMethod())); } } // JDBC ResultSet ? Key Object key = JdbcUtils.getResultSetValue(rs, keyColumnIndex, keyType); if (key != null && !keyType.isInstance(key)) { ResultSetMetaData rsmd = rs.getMetaData(); throw new TypeMismatchDataAccessException( // NL "Type mismatch affecting row number " + rowNum + " and column type '" + rsmd.getColumnTypeName(keyColumnIndex) + "' expected type is '" + keyType + "'"); } return new MapEntryImpl<Object, Object>(key, mapper.mapRow(rs, rowNum)); }
From source file:com.gzj.tulip.jade.rowmapper.MapEntryColumnRowMapper.java
public Object mapRow(ResultSet rs, int rowNum) throws SQLException { // ?// ww w. j av a2 s . c o m if (rowNum == 0) { ResultSetMetaData rsmd = rs.getMetaData(); int nrOfColumns = rsmd.getColumnCount(); if (nrOfColumns != 2) { throw new IncorrectResultSetColumnCountException(2, nrOfColumns); } if (StringUtils.isNotEmpty(keyColumn)) { keyColumnIndex = rs.findColumn(keyColumn); if (keyColumnIndex == 1) { valueColumnIndex = 2; } else if (keyColumnIndex == 2) { valueColumnIndex = 1; } else { throw new IllegalArgumentException( String.format("wrong key name %s for method: %s ", keyColumn, modifier.getMethod())); } keyColumn = null; } if (logger.isDebugEnabled()) { logger.debug(String.format("keyIndex=%s; valueIndex=%s; for method: %s ", keyColumnIndex, valueColumnIndex, modifier.getMethod())); } } // JDBC ResultSet ? Key Object key = JdbcUtils.getResultSetValue(rs, keyColumnIndex, keyType); if (key != null && !keyType.isInstance(key)) { ResultSetMetaData rsmd = rs.getMetaData(); throw new TypeMismatchDataAccessException( // NL "Type mismatch affecting row number " + rowNum + " and column type '" + rsmd.getColumnTypeName(keyColumnIndex) + "' expected type is '" + keyType + "'"); } // JDBC ResultSet ? Value Object value = JdbcUtils.getResultSetValue(rs, valueColumnIndex, valueType); if (value != null && !valueType.isInstance(value)) { ResultSetMetaData rsmd = rs.getMetaData(); throw new TypeMismatchDataAccessException( // NL "Type mismatch affecting row number " + rowNum + " and column type '" + rsmd.getColumnTypeName(valueColumnIndex) + "' expected type is '" + valueType + "'"); } // key?null?? return new MapEntryImpl<Object, Object>(key, value); }
From source file:com._4dconcept.springframework.data.marklogic.repository.support.MarklogicRepositoryFactory.java
@Override @SuppressWarnings("unchecked") public <T, ID> MarklogicEntityInformation<T, ID> getEntityInformation(Class<T> domainClass) { MarklogicPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(domainClass); if (persistentEntity == null) { throw new TypeMismatchDataAccessException( String.format("No Persistent Entity information found for the class %s", domainClass)); }/*from www . j a va 2s . co m*/ return new MappingMarklogicEntityInformation<>((MarklogicPersistentEntity<T>) persistentEntity); }
From source file:no.trank.openpipe.jdbc.store.IdStateHolder.java
private static void validateTable(Column colId, Column colUpd, int idMaxLength) { if (!colId.isStringColumn()) { throw new TypeMismatchDataAccessException("Type for " + colId.getName() + " was: '" + colId.getType().getName() + "' should be '" + VARCHAR.getName() + '\''); }// w ww .j a v a 2 s.c o m final StringColumn id = (StringColumn) colId; if (id.getLength() < idMaxLength) { throw new TypeMismatchDataAccessException("Length for " + colId.getName() + " was: " + id.getLength() + " should be at least " + idMaxLength); } if (!TIMESTAMP.equals(colUpd.getType())) { throw new TypeMismatchDataAccessException("Type for " + colUpd.getName() + " was: '" + colUpd.getType().getName() + "' should be '" + TIMESTAMP.getName() + '\''); } }
From source file:com._4dconcept.springframework.data.marklogic.core.MarklogicTemplate.java
private MarklogicPersistentEntity<?> retrievePersistentEntity(Class<?> aClass) { MarklogicPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(aClass); if (persistentEntity == null) { throw new TypeMismatchDataAccessException( String.format("No Persistent Entity information found for the class %s", aClass)); }/* w w w . j a v a2 s.c o m*/ return persistentEntity; }