List of usage examples for org.hibernate TypeMismatchException TypeMismatchException
public TypeMismatchException(String message)
From source file:com.testing26thjuly_.db123testing.controller.ViewTypesSpacingController.java
License:Open Source License
@RequestMapping(value = "/composite-id/content/{fieldName}", method = RequestMethod.GET) @ApiOperation(value = "Retrieves content for the given BLOB field in ViewTypesSpacing instance associated with the given composite-id.") public void getViewTypesSpacingBLOBContent(@RequestParam("id") int id, @RequestParam("byteCol") Byte byteCol, @RequestParam("shortCol") Short shortCol, @RequestParam("intCol") Integer intCol, @RequestParam("longCol") BigInteger longCol, @RequestParam("bigIntCol") BigInteger bigIntCol, @RequestParam("floatCol") Float floatCol, @RequestParam("doubleCol") Double doubleCol, @RequestParam("bigDecCol") BigDecimal bigDecCol, @RequestParam("charCol") Character charCol, @RequestParam("stringCol") String stringCol, @RequestParam("textCol") String textCol, @RequestParam("booleanCol") Boolean booleanCol, @RequestParam("blobCol") byte[] blobCol, @RequestParam("datetimeCol") Date datetimeCol, @RequestParam("timestampCol") Date timestampCol, @RequestParam("dateCol") Date dateCol, @RequestParam("timeCol") Date timeCol, @PathVariable("fieldName") String fieldName, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws EntityNotFoundException { LOGGER.debug("Retrieves content for the given BLOB field {} in ViewTypesSpacing instance", fieldName); if (!WMRuntimeUtils.isLob(ViewTypesSpacing.class, fieldName)) { throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type"); }//from w w w. j a va 2 s .co m ViewTypesSpacingId viewtypesspacingId = new ViewTypesSpacingId(); viewtypesspacingId.setId(id); viewtypesspacingId.setByteCol(byteCol); viewtypesspacingId.setShortCol(shortCol); viewtypesspacingId.setIntCol(intCol); viewtypesspacingId.setLongCol(longCol); viewtypesspacingId.setBigIntCol(bigIntCol); viewtypesspacingId.setFloatCol(floatCol); viewtypesspacingId.setDoubleCol(doubleCol); viewtypesspacingId.setBigDecCol(bigDecCol); viewtypesspacingId.setCharCol(charCol); viewtypesspacingId.setStringCol(stringCol); viewtypesspacingId.setTextCol(textCol); viewtypesspacingId.setBooleanCol(booleanCol); viewtypesspacingId.setBlobCol(blobCol); viewtypesspacingId.setDatetimeCol(datetimeCol); viewtypesspacingId.setTimestampCol(timestampCol); viewtypesspacingId.setDateCol(dateCol); viewtypesspacingId.setTimeCol(timeCol); ViewTypesSpacing viewtypesspacing = viewTypesSpacingService.getById(viewtypesspacingId); WMMultipartUtils.buildHttpResponseForBlob(viewtypesspacing, fieldName, httpServletRequest, httpServletResponse); }
From source file:com.testing26thjuly_.wmstudio.controller.AlltypesController.java
License:Open Source License
@RequestMapping(value = "/{id}/content/{fieldName}", method = RequestMethod.GET, produces = "application/octet-stream") @ApiOperation(value = "Retrieves content for the given BLOB field in Alltypes instance") public DownloadResponse getAlltypesBLOBContent(@PathVariable("id") Integer id, @PathVariable("fieldName") String fieldName, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, @RequestParam(value = "download", defaultValue = "false") boolean download) { LOGGER.debug("Retrieves content for the given BLOB field {} in Alltypes instance", fieldName); if (!WMRuntimeUtils.isLob(Alltypes.class, fieldName)) { throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type"); }//from ww w.j a v a 2 s . c o m Alltypes alltypes = alltypesService.getById(id); return WMMultipartUtils.buildDownloadResponseForBlob(alltypes, fieldName, httpServletRequest, download); }
From source file:com.testingapi_s.api_testing_db.controller.EmployeeController.java
License:Open Source License
@ApiOperation(value = "Retrieves content for the given BLOB field in Employee instance") @RequestMapping(value = "/{id}/content/{fieldName}", method = RequestMethod.GET, produces = "application/octet-stream") @WMAccessVisibility(value = AccessSpecifier.APP_ONLY) public DownloadResponse getEmployeeBLOBContent(@PathVariable("id") Integer id, @PathVariable("fieldName") String fieldName, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, @RequestParam(value = "download", defaultValue = "false") boolean download) { LOGGER.debug("Retrieves content for the given BLOB field {} in Employee instance", fieldName); if (!WMRuntimeUtils.isLob(Employee.class, fieldName)) { throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type"); }//w w w . jav a 2s.c o m Employee employee = employeeService.getById(id); return WMMultipartUtils.buildDownloadResponseForBlob(employee, fieldName, httpServletRequest, download); }
From source file:com.testmssqlimport.adventureworks2014.controller.EmployeeController.java
License:Open Source License
@RequestMapping(value = "/{id}/content/{fieldName}", method = RequestMethod.GET, produces = "application/octet-stream") @ApiOperation(value = "Retrieves content for the given BLOB field in Employee instance") public DownloadResponse getEmployeeBLOBContent(@PathVariable("id") Integer id, @PathVariable("fieldName") String fieldName, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, @RequestParam(value = "download", defaultValue = "false") boolean download) { LOGGER.debug("Retrieves content for the given BLOB field {} in Employee instance", fieldName); if (!WMRuntimeUtils.isLob(Employee.class, fieldName)) { throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type"); }/* ww w . j a v a 2 s . c o m*/ Employee instance = employeeService.findById(id); return WMMultipartUtils.buildDownloadResponseForBlob(instance, fieldName, httpServletRequest, download); }
From source file:com.testmvnbuild.dbscenarios.controller.AllExternalTypesController.java
License:Open Source License
@ApiOperation(value = "Retrieves content for the given BLOB field in AllExternalTypes instance associated with the given composite-id.") @RequestMapping(value = "/composite-id/content/{fieldName}", method = RequestMethod.GET) @WMAccessVisibility(value = AccessSpecifier.APP_ONLY) public void getAllExternalTypesBLOBContent(@RequestParam("tinyIntCol") Short tinyIntCol, @RequestParam("smallIntCol") Short smallIntCol, @RequestParam("mediumIntCol") Integer mediumIntCol, @RequestParam("intCol") Integer intCol, @RequestParam("bigintCol") BigInteger bigintCol, @RequestParam("decimalCol") Integer decimalCol, @RequestParam("floatCol") Double floatCol, @RequestParam("doubleCol") BigDecimal doubleCol, @RequestParam("bitCol") Boolean bitCol, @RequestParam("booleanCol") Boolean booleanCol, @RequestParam("serialCol") BigInteger serialCol, @RequestParam("dateCol") Date dateCol, @RequestParam("datetimeCol") LocalDateTime datetimeCol, @RequestParam("timestampCol") Date timestampCol, @RequestParam("timeCol") Date timeCol, @RequestParam("charCol") Character charCol, @RequestParam("varcharCol") String varcharCol, @RequestParam("tinytextCol") String tinytextCol, @RequestParam("textCol") String textCol, @RequestParam("mediumTextCol") String mediumTextCol, @RequestParam("longtextCol") String longtextCol, @RequestParam("blobCol") byte[] blobCol, @RequestParam("longblobCol") byte[] longblobCol, @PathVariable("fieldName") String fieldName, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws EntityNotFoundException { LOGGER.debug("Retrieves content for the given BLOB field {} in AllExternalTypes instance", fieldName); if (!WMRuntimeUtils.isLob(AllExternalTypes.class, fieldName)) { throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type"); }//from ww w.ja v a2 s .co m AllExternalTypesId allexternaltypesId = new AllExternalTypesId(); allexternaltypesId.setTinyIntCol(tinyIntCol); allexternaltypesId.setSmallIntCol(smallIntCol); allexternaltypesId.setMediumIntCol(mediumIntCol); allexternaltypesId.setIntCol(intCol); allexternaltypesId.setBigintCol(bigintCol); allexternaltypesId.setDecimalCol(decimalCol); allexternaltypesId.setFloatCol(floatCol); allexternaltypesId.setDoubleCol(doubleCol); allexternaltypesId.setBitCol(bitCol); allexternaltypesId.setBooleanCol(booleanCol); allexternaltypesId.setSerialCol(serialCol); allexternaltypesId.setDateCol(dateCol); allexternaltypesId.setDatetimeCol(datetimeCol); allexternaltypesId.setTimestampCol(timestampCol); allexternaltypesId.setTimeCol(timeCol); allexternaltypesId.setCharCol(charCol); allexternaltypesId.setVarcharCol(varcharCol); allexternaltypesId.setTinytextCol(tinytextCol); allexternaltypesId.setTextCol(textCol); allexternaltypesId.setMediumTextCol(mediumTextCol); allexternaltypesId.setLongtextCol(longtextCol); allexternaltypesId.setBlobCol(blobCol); allexternaltypesId.setLongblobCol(longblobCol); AllExternalTypes allExternalTypes = allExternalTypesService.getById(allexternaltypesId); WMMultipartUtils.buildHttpResponseForBlob(allExternalTypes, fieldName, httpServletRequest, httpServletResponse); }
From source file:com.testmvnbuild.dbscenarios.controller.AllTypesController.java
License:Open Source License
@ApiOperation(value = "Retrieves content for the given BLOB field in AllTypes instance") @RequestMapping(value = "/{id}/content/{fieldName}", method = RequestMethod.GET, produces = "application/octet-stream") @WMAccessVisibility(value = AccessSpecifier.APP_ONLY) public DownloadResponse getAllTypesBLOBContent(@PathVariable("id") Integer id, @PathVariable("fieldName") String fieldName, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, @RequestParam(value = "download", defaultValue = "false") boolean download) { LOGGER.debug("Retrieves content for the given BLOB field {} in AllTypes instance", fieldName); if (!WMRuntimeUtils.isLob(AllTypes.class, fieldName)) { throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type"); }/*from w ww. j a va2 s. c o m*/ AllTypes allTypes = allTypesService.getById(id); return WMMultipartUtils.buildDownloadResponseForBlob(allTypes, fieldName, httpServletRequest, download); }
From source file:gov.nih.nci.iso21090.hibernate.usertype.EntityPartNameQualifierUserType.java
License:BSD License
/** * @param resultSet resultset object// w ww .j av a 2s . co m * @param names names of the columns in the resultset * @param owner parent object on which the value is to be set * @return returns Set<EntityPartQualifier> object * @throws SQLException throws exception when error occurs in accessing the resultSet */ public Object nullSafeGet(ResultSet resultSet, String[] names, Object owner) throws SQLException { String strEntityPartQualifier = resultSet.getString(names[0]); if (strEntityPartQualifier == null) { return null; } Set<EntityNamePartQualifier> entityNamePartyQualifierSet = new HashSet(); String[] qualifiers = strEntityPartQualifier.split(","); for (String enpqVal : qualifiers) { try { entityNamePartyQualifierSet.add(Enum.valueOf(EntityNamePartQualifier.class, enpqVal)); } catch (IllegalArgumentException e) { throw new TypeMismatchException(e); } } return entityNamePartyQualifierSet; }
From source file:gov.nih.nci.iso21090.hibernate.usertype.UriUserType.java
License:BSD License
/** * @param resultSet resultset object//from w w w .j a va 2 s. co m * @param names names of the columns in the resultset * @param owner parent object on which the value is to be set * @return returns URI object * @throws SQLException throws exception when error occurs in accessing the resultSet */ public Object nullSafeGet(ResultSet resultSet, String[] names, Object owner) throws SQLException { String strURI = resultSet.getString(names[0]); URI uri = null; if (null != strURI) { try { uri = new URI(strURI); } catch (URISyntaxException e) { throw new TypeMismatchException(e); } } return uri; }
From source file:gov.nih.nci.iso21090.hibernate.usertype.UriUserType.java
License:BSD License
/** * @param value value being copied/*from w w w . j a v a 2 s . com*/ * @return copied value */ public Object deepCopy(Object value) { if (value == null) { return null; } try { return new URI(((URI) value).toString()); } catch (URISyntaxException e) { throw new TypeMismatchException(e); } }
From source file:org.codekaizen.vtj.hibernate3.AbstractValueTypeUserType.java
License:Open Source License
@SuppressWarnings("unchecked") public void nullSafeSet(final PreparedStatement st, final Object value, final int index) throws HibernateException, SQLException { if (value == null) { st.setNull(index, this.types[0]); } else if (!(this.clazz.isAssignableFrom(value.getClass()))) { throw new TypeMismatchException("Supplied object must be of type " + this.clazz.getName()); } else {/*from w ww . ja v a 2 s . com*/ this.convertToDbType(st, (T) value, index); } }