@PrePersist
    @PreUpdate
    private void updateImageData() throws CustomConstraintViolationException {
        thumbnail = createImage(true);
        imageFile.validate();
        if (imageData != null) {
            imageContentHash = HashUtilities.generateSHA256(imageData).toCharArray();
        }
    }
@PrePersist
    @PreUpdate
    private void updateImageData() throws CustomConstraintViolationException {
        thumbnail = createImage(true);
        imageFile.validate();
        if (imageData != null) {
            imageContentHash = HashUtilities.generateSHA256(imageData).toCharArray();
        }
    }
@ PrePersist @ PreUpdate private void updateImageData ( ) throws CustomConstraintViolationException { thumbnail = createImage ( true ) ; imageFile . validate ( ) ; if ( imageData != null ) { imageContentHash = HashUtilities . generateSHA256 ( imageData ) . toCharArray ( ) ; } }
Create the thumbnails, and make sure the parent imagefile is valid.

@throws CustomConstraintViolationException
Create the thumbnails and make sure the parent imagefile is valid .