Reading Blob data from Oracle-using hibernate

Source: Internet
Author: User
Using hibernate to store bytes of data (such as byte []) to Oracle, you cannot use quot; privatebyte [] contentquot; when defining object.

Using hibernate to store bytes of data (such as byte []) to Oracle, you cannot use quot; private byte [] contentquot; when defining object.

Using hibernate to store data of the byte type (such as byte []) to Oracle, you cannot use "private byte [] content" when defining an object. I have tried this definition, when storing data (session. save (user) is correct, but the problem occurs when reading Blob fields (the byte [] stored in Oracle uses the "BLOB" type, the read is garbled.

When reading Blob fields using hibernate, the object (corresponding byte [] Type field) should be defined as follows:

Corresponding hibernate file Configuration:

How to read Blob data:

About input and output streams

The read-in stream must naturally have a read source, and the output must also be output to a certain place. The output usually needs to be read first. Here, the input and output are connected to a buffer in the memory byte array. in this way, the database reads the array, and the output stream is output from this array to a specific file format.

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.