Hibernate Version: 2.1.2
Database: Oracle 9i
Mapping File: (Only two columns displayed)
<property name="State" column="STATE" type="int"/>
<property name="XmlBlobProcess" column="XMLFILE" type="blob" not-null="true"/>
The XMLFILE column in the database is a of Blob data type.
I have tried giving the type as "blob" and "java.sql.Blob" without success.
Problem:
There is a castor generated object and I do the following things:
1. Marshall the object using the castor marshall method into a output stream
2. Get the bytearray of the outstream and use this to build a BlobImpl object (The blobImpl here is imported from hibernate package)
3. Set this blobimpl object to the java.sql.Blob field in the Info object
4. Call hibernates update method to update the object in the database.
I am tracing the size of the BlobImpl while saving the object from the UI.
If the size of the BlobImpl is less that 2000 bytes, then updation into database is successful.
If the size of the BlobImpl is greater than 2000, then the XMLFILE column data is being set to NULL. Since there is a not-null constraint in the DB, I am getting a error.
If I again reduce the size of the object (by making some modification in UI) to less than 2000, I am able to save the object.
Please let me know the significance of this 2000 bytes, and why is the attribute in the info being set to null, when the size is greater than 2000 bytes.
|