java - Read image stored as blob, directly into byte[] using springdata -
i have image stored in oracle database , i'm using spring data retrieve image.
@query("select c.binarycontent contententity c join c.parentcontententities pce pce.specificentity.id = :id , pce.contenttype.id = 11") byte [] getimagebinarycontent(@param("id") long id); @lob @column(name = "binary_content") private byte [] binarycontent; byte[] testimagearray = servicelayer.getimagebinarycontent(id) returns null
tested individually query works. finds content when call made getimagebinarycontent passing in id, nothing back, null result. if change return type blob, blob back.
why can't read blob byte array directly? searches have shown examples of getting blob returned, , converting blob inputstream byte array, seems should able directly.
Comments
Post a Comment