Example usage for org.hibernate TypeMismatchException TypeMismatchException

List of usage examples for org.hibernate TypeMismatchException TypeMismatchException

Introduction

In this page you can find the example usage for org.hibernate TypeMismatchException TypeMismatchException.

Prototype

public TypeMismatchException(String message) 

Source Link

Document

Constructs a TypeMismatchException using the supplied message.

Usage

From source file:com.student_usecase.school_db.controller.StudentDetailsController.java

License:Open Source License

@ApiOperation(value = "Retrieves content for the given BLOB field in StudentDetails instance")
@RequestMapping(value = "/{id}/content/{fieldName}", method = RequestMethod.GET, produces = "application/octet-stream")
@WMAccessVisibility(value = AccessSpecifier.APP_ONLY)
public DownloadResponse getStudentDetailsBLOBContent(@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 StudentDetails instance", fieldName);
    if (!WMRuntimeUtils.isLob(StudentDetails.class, fieldName)) {
        throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type");
    }//from w ww .  jav  a2s  .  com
    StudentDetails studentDetails = studentDetailsService.getById(id);
    return WMMultipartUtils.buildDownloadResponseForBlob(studentDetails, fieldName, httpServletRequest,
            download);
}

From source file:com.tcitest2.poctest.controller.MedicationPhotosController.java

License:Open Source License

@ApiOperation(value = "Retrieves content for the given BLOB field in MedicationPhotos instance")
@RequestMapping(value = "/{id}/content/{fieldName}", method = RequestMethod.GET, produces = "application/octet-stream")
@WMAccessVisibility(value = AccessSpecifier.APP_ONLY)
public DownloadResponse getMedicationPhotosBLOBContent(@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 MedicationPhotos instance", fieldName);
    if (!WMRuntimeUtils.isLob(MedicationPhotos.class, fieldName)) {
        throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type");
    }/*from ww w. j ava2  s  . c o  m*/
    MedicationPhotos medicationPhotos = medicationPhotosService.getById(id);
    return WMMultipartUtils.buildDownloadResponseForBlob(medicationPhotos, fieldName, httpServletRequest,
            download);
}

From source file:com.tcitest2.poctest.controller.PatientsController.java

License:Open Source License

@ApiOperation(value = "Retrieves content for the given BLOB field in Patients instance")
@RequestMapping(value = "/{id}/content/{fieldName}", method = RequestMethod.GET, produces = "application/octet-stream")
@WMAccessVisibility(value = AccessSpecifier.APP_ONLY)
public DownloadResponse getPatientsBLOBContent(@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 Patients instance", fieldName);
    if (!WMRuntimeUtils.isLob(Patients.class, fieldName)) {
        throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type");
    }//from w  w w  .  j a  va2  s. co  m
    Patients patients = patientsService.getById(id);
    return WMMultipartUtils.buildDownloadResponseForBlob(patients, fieldName, httpServletRequest, download);
}

From source file:com.testallservicesforvcs.adventureworks2014.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");
    }//from ww  w.j a  v a2  s.  co  m
    Employee employee = employeeService.getById(id);

    return WMMultipartUtils.buildDownloadResponseForBlob(employee, fieldName, httpServletRequest, download);
}

From source file:com.testing26thjuly_.db123testing.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");
    }/*ww  w. j  a va2  s  .c  om*/
    AllTypes alltypes = allTypesService.getById(id);
    return WMMultipartUtils.buildDownloadResponseForBlob(alltypes, fieldName, httpServletRequest, download);
}

From source file:com.testing26thjuly_.db123testing.controller.NewTypesUserController.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 NewTypesUser instance")
public DownloadResponse getNewTypesUserBLOBContent(@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 NewTypesUser instance", fieldName);
    if (!WMRuntimeUtils.isLob(NewTypesUser.class, fieldName)) {
        throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type");
    }/*w w w.  ja  v a2s  .  c  o  m*/
    NewTypesUser newtypesuser = newTypesUserService.getById(id);
    return WMMultipartUtils.buildDownloadResponseForBlob(newtypesuser, fieldName, httpServletRequest, download);
}

From source file:com.testing26thjuly_.db123testing.controller.SelfRelationTableController.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 SelfRelationTable instance")
public DownloadResponse getSelfRelationTableBLOBContent(@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 SelfRelationTable instance", fieldName);
    if (!WMRuntimeUtils.isLob(SelfRelationTable.class, fieldName)) {
        throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type");
    }//w  w  w  . j  a  va2s  .c  o m
    SelfRelationTable selfrelationtable = selfRelationTableService.getById(id);
    return WMMultipartUtils.buildDownloadResponseForBlob(selfrelationtable, fieldName, httpServletRequest,
            download);
}

From source file:com.testing26thjuly_.db123testing.controller.TypesSpacingController.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 TypesSpacing instance")
public DownloadResponse getTypesSpacingBLOBContent(@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 TypesSpacing instance", fieldName);
    if (!WMRuntimeUtils.isLob(TypesSpacing.class, fieldName)) {
        throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type");
    }/*ww  w . ja  v  a2  s  .  c o  m*/
    TypesSpacing typesspacing = typesSpacingService.getById(id);
    return WMMultipartUtils.buildDownloadResponseForBlob(typesspacing, fieldName, httpServletRequest, download);
}

From source file:com.testing26thjuly_.db123testing.controller.V1Controller.java

License:Open Source License

@RequestMapping(value = "/composite-id/content/{fieldName}", method = RequestMethod.GET)
@ApiOperation(value = "Retrieves content for the given BLOB field in V1 instance associated with the given composite-id.")
public void getV1BLOBContent(@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("timestampCol") Date timestampCol, @RequestParam("dateCol") Date dateCol,
        @RequestParam("timeCol") Date timeCol, @RequestParam("datetimeCol") Date datetimeCol,
        @PathVariable("fieldName") String fieldName, HttpServletRequest httpServletRequest,
        HttpServletResponse httpServletResponse) throws EntityNotFoundException {
    LOGGER.debug("Retrieves content for the given BLOB field {} in V1 instance", fieldName);
    if (!WMRuntimeUtils.isLob(V1.class, fieldName)) {
        throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type");
    }/* w  ww  . j  ava2 s  . c om*/
    V1Id v1Id = new V1Id();
    v1Id.setId(id);
    v1Id.setByteCol(byteCol);
    v1Id.setShortCol(shortCol);
    v1Id.setIntCol(intCol);
    v1Id.setLongCol(longCol);
    v1Id.setBigIntCol(bigIntCol);
    v1Id.setFloatCol(floatCol);
    v1Id.setDoubleCol(doubleCol);
    v1Id.setBigDecCol(bigDecCol);
    v1Id.setCharCol(charCol);
    v1Id.setStringCol(stringCol);
    v1Id.setTextCol(textCol);
    v1Id.setBooleanCol(booleanCol);
    v1Id.setBlobCol(blobCol);
    v1Id.setTimestampCol(timestampCol);
    v1Id.setDateCol(dateCol);
    v1Id.setTimeCol(timeCol);
    v1Id.setDatetimeCol(datetimeCol);
    V1 v1 = v1Service.getById(v1Id);
    WMMultipartUtils.buildHttpResponseForBlob(v1, fieldName, httpServletRequest, httpServletResponse);
}

From source file:com.testing26thjuly_.db123testing.controller.ViewSelfRelationController.java

License:Open Source License

@RequestMapping(value = "/composite-id/content/{fieldName}", method = RequestMethod.GET)
@ApiOperation(value = "Retrieves content for the given BLOB field in ViewSelfRelation instance associated with the given composite-id.")
public void getViewSelfRelationBLOBContent(@RequestParam("id") int id, @RequestParam("dateCol") Date dateCol,
        @RequestParam("datetimeCol") Date datetimeCol, @RequestParam("timeCol") Date timeCol,
        @RequestParam("timestampCol") Date timestampCol, @RequestParam("booleanCol") Boolean booleanCol,
        @RequestParam("blobCol") byte[] blobCol, @RequestParam("intCol") Integer intCol,
        @PathVariable("fieldName") String fieldName, HttpServletRequest httpServletRequest,
        HttpServletResponse httpServletResponse) throws EntityNotFoundException {
    LOGGER.debug("Retrieves content for the given BLOB field {} in ViewSelfRelation instance", fieldName);
    if (!WMRuntimeUtils.isLob(ViewSelfRelation.class, fieldName)) {
        throw new TypeMismatchException("Given field " + fieldName + " is not a valid BLOB type");
    }//from   w w  w .  ja  v  a 2s  .c o  m
    ViewSelfRelationId viewselfrelationId = new ViewSelfRelationId();
    viewselfrelationId.setId(id);
    viewselfrelationId.setDateCol(dateCol);
    viewselfrelationId.setDatetimeCol(datetimeCol);
    viewselfrelationId.setTimeCol(timeCol);
    viewselfrelationId.setTimestampCol(timestampCol);
    viewselfrelationId.setBooleanCol(booleanCol);
    viewselfrelationId.setBlobCol(blobCol);
    viewselfrelationId.setIntCol(intCol);
    ViewSelfRelation viewselfrelation = viewSelfRelationService.getById(viewselfrelationId);
    WMMultipartUtils.buildHttpResponseForBlob(viewselfrelation, fieldName, httpServletRequest,
            httpServletResponse);
}