> Hi Jacopo, I was able to reproduce it in OFBiz but only after
> applying the patch called psql-label-image.patch from http://
> jira.undersunconsulting.com/browse/OFBIZ-334
>
> I've attached it for convenience. This patch resolves an issue with
> PostgreSQL 8.0 and others, which is why it was applied to
> sequoiaerp. But it broke Derby. I suspect it's because Derby
> doesn't have a BINARY type and this code is setting BINARY.
>
> - Leon
>
>
>
> Jacopo Cappellato wrote:
>> Hi Leon,
>> I've run the tests in the latest SVN rev with Derby and all the
>> tests completed without errors.
>> Can you reproduce it in OFBiz too?
>> Jacopo
>> Leon Torres wrote:
>>> Hi folks,
>>>
>>> I ran the updated EntityTestSuite with the BLOB tests on a fresh
>>> Sequoiaerp 0.8.3. (This involves copying the java file and the
>>> entity*_test.xml from framework/entity and doing ant run-tests).
>>>
>>> The Entity Engine is still crashing when trying to create/read
>>> BLOBS. The test suite's messages are:
>>>
>>>
>>> [JUNIT] ---------------------------- FAILURES
>>> ---------------------------- [JUNIT]
>>> [java] 67960 (main) [ JunitContainer.java:104:INFO ] -->
>>> testSetNullBlob(org.ofbiz.entity.test.EntityTestSuite):
>>> GenericEntityException:org.ofbiz.entity.GenericEntityException:
>>> Exception while inserting the following entity:
>>> [GenericEntity:TestBlob][createdStamp,2006-02-10 10:00:16.54
>>> (java.sql.Timestamp)][createdTxStamp,2006-02-10 10:00:16.539
>>> (java.sql.Timestamp)][lastUpdatedStamp,2006-02-10 10:00:16.54
>>> (java.sql.Timestamp)][lastUpdatedTxStamp,2006-02-10 10:00:16.539
>>> (java.sql.Timestamp)][testBlobId,null-blob(java.lang.String)]
>>> (while inserting: [GenericEntity:TestBlob][createdStamp,
>>> 2006-02-10 10:00:16.54(java.sql.Timestamp)][createdTxStamp,
>>> 2006-02-10 10:00:16.539(java.sql.Timestamp)][lastUpdatedStamp,
>>> 2006-02-10 10:00:16.54(java.sql.Timestamp)][lastUpdatedTxStamp,
>>> 2006-02-10 10:00:16.539(java.sql.Timestamp)][testBlobId,null-blob
>>> (java.lang.String)]
>>>
>>> (SQL Exception while setting value on field [testBlobField] of
>>> entity TestBlob: (An attempt was made to get a data value of
>>> type 'BLOB' from a data value of type 'BINARY'.)))
>>>
>>>
>>> And the exception trace where the error occurs reads:
>>>
>>> [java] ---- stack trace
>>> ---------------------------------------------------------------
>>> [java] org.ofbiz.entity.GenericEntityException: Exception while
>>> inserting the following entity: [GenericEntity:TestBlob]
>>> [createdStamp,2006-02-10 10:00:16.54(java.sql.Timestamp)]
>>> [createdTxStamp,2006-02-10 10:00:16.539(java.sql.Timestamp)]
>>> [lastUpdatedStamp,2006-02-10 10:00:16.54(java.sql.Timestamp)]
>>> [lastUpdatedTxStamp,2006-02-10 10:00:16.539(java.sql.Timestamp)]
>>> [testBlobId,null-blob(java.lang.String)] (while inserting:
>>> [GenericEntity:TestBlob][createdStamp,2006-02-10 10:00:16.54
>>> (java.sql.Timestamp)][createdTxStamp,2006-02-10 10:00:16.539
>>> (java.sql.Timestamp)][lastUpdatedStamp,2006-02-10 10:00:16.54
>>> (java.sql.Timestamp)][lastUpdatedTxStamp,2006-02-10 10:00:16.539
>>> (java.sql.Timestamp)][testBlobId,null-blob(java.lang.String)]
>>> (SQL Exception while setting value on field [testBlobField] of
>>> entity TestBlob: (An attempt was made to get a data value of
>>> type 'BLOB' from a data value of type 'BINARY'.)))
>>>
>>> [java] org.ofbiz.entity.datasource.GenericDAO.insert
>>> (GenericDAO.java:140)
>>> [java] org.ofbiz.entity.datasource.GenericHelperDAO.create
>>> (GenericHelperDAO.java:75)
>>> [java] org.ofbiz.entity.GenericDelegator.create
>>> (GenericDelegator.java:582)
>>> [java] org.ofbiz.entity.GenericDelegator.create
>>> (GenericDelegator.java:547)
>>> [java] org.ofbiz.entity.test.EntityTestSuite.testSetNullBlob
>>> (EntityTestSuite.java:531)
>>>
>>> Any ideas why this might be happening?
>>>
>>> - Leon
>>> _______________________________________________
>>> Dev mailing list
>>>
[hidden email]
>>>
http://lists.ofbiz.org/mailman/listinfo/dev>>>
>> _______________________________________________
>> Dev mailing list
>>
[hidden email]
>>
http://lists.ofbiz.org/mailman/listinfo/dev> Index: framework/entity/fieldtype/fieldtypepostgres.xml
> ===================================================================
> --- framework/entity/fieldtype/fieldtypepostgres.xml
> +++ framework/entity/fieldtype/fieldtypepostgres.xml
> @@ -27,7 +27,7 @@
> xsi:noNamespaceSchemaLocation="
http://www.ofbiz.org/dtds/
> fieldtypemodel.xsd">
> <!-- ===================== field-type-def ==================== -->
> <!-- General Types -->
> - <field-type-def type="blob" sql-type="OID" java-
> type="java.lang.Object"></field-type-def>
> + <field-type-def type="blob" sql-type="BYTEA" java-
> type="java.lang.Object"></field-type-def>
>
> <field-type-def type="date-time" sql-type="TIMESTAMPTZ" java-
> type="java.sql.Timestamp"></field-type-def>
> <field-type-def type="date" sql-type="DATE" java-
> type="java.sql.Date"></field-type-def>
> Index: applications/product/src/org/ofbiz/shipment/shipment/
> ShipmentEvents.java
> ===================================================================
> --- applications/product/src/org/ofbiz/shipment/shipment/
> ShipmentEvents.java
> +++ applications/product/src/org/ofbiz/shipment/shipment/
> ShipmentEvents.java
> @@ -70,8 +70,8 @@
> return "error";
> }
>
> - ByteWrapper byteWrapper = (ByteWrapper)
> shipmentPackageRouteSeg.get("labelImage");
> - if (byteWrapper == null || byteWrapper.getBytes().length
> == 0) {
> + byte[] bytes = shipmentPackageRouteSeg.getBytes
> ("labelImage");
> + if (bytes == null || bytes.length == 0) {
> request.setAttribute("_ERROR_MESSAGE_", "The
> ShipmentPackageRouteSeg was found where shipmentId=[" + shipmentId
> + "], shipmentRouteSegmentId=[" + shipmentRouteSegmentId + "],
> shipmentPackageSeqId=[" + shipmentPackageSeqId + "], but there was
> no labelImage on the value.");
> return "error";
> }
> @@ -79,10 +79,10 @@
> // TODO: record the image format somehow to make this
> block nicer. Right now we're just trying GIF first as a default,
> then if it doesn't work, trying PNG.
> // It would be nice to store the actual type of the image
> alongside the image data.
> try {
> - UtilHttp.streamContentToBrowser(response,
> byteWrapper.getBytes(), "image/gif");
> + UtilHttp.streamContentToBrowser(response, bytes,
> "image/gif");
> } catch (IOException e1) {
> try {
> - UtilHttp.streamContentToBrowser(response,
> byteWrapper.getBytes(), "image/png");
> + UtilHttp.streamContentToBrowser(response, bytes,
> "image/png");
> } catch (IOException e2) {
> String errorMsg = "Error writing labelImage to
> OutputStream: " + e2.toString();
> Debug.logError(e2, errorMsg, module);
> Index: framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java
> ===================================================================
> --- framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java
> +++ framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java
> @@ -775,7 +775,7 @@
> throw new SQLException(ex.getMessage());
> }
> } else {
> - _ps.setNull(_ind, Types.BLOB);
> + _ps.setNull(_ind, Types.BINARY);
> }
>
> _ind++;
>
> _______________________________________________
> Dev mailing list
>
[hidden email]
>
http://lists.ofbiz.org/mailman/listinfo/dev