Discussion: New Field Types

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Discussion: New Field Types

Adrian Crum-2
The blob field type is being used as a catch-all for multiple binary types. Right now getting an object from a blob field type could return a byte array, a deserialized Java object, or a javax.sql.rowset.serial.SerialBlob object. There is no way to know for sure what will be returned - the entity engine code tries various methods until one works.

I think it would be better to specify exactly what you intend to store in a BLOB SQL type: a byte array, a serialized Java object, or some unknown binary type. So, I propose that we add two new field types: byte-array and object. Using Derby as an example, this is what it would look like in fieldtypederby.xml:

<field-type-def type="blob" sql-type="BLOB" java-type="java.sql.Blob"></field-type-def>
<field-type-def type="byte-array" sql-type="BLOB" java-type="byte[]"></field-type-def>
<field-type-def type="object" sql-type="BLOB" java-type="java.lang.Object"></field-type-def>

Getting an object from each field type would return the respective Java object type.

What do you think?

-Adrian



     
Reply | Threaded
Open this post in threaded view
|

Re: Discussion: New Field Types

Jacques Le Roux
Administrator
Looks like a good idea to me. I suppose you would keep backward compatibility?

Jacques

From: "Adrian Crum" <[hidden email]>

> The blob field type is being used as a catch-all for multiple binary types. Right now getting an object from a blob field type
> could return a byte array, a deserialized Java object, or a javax.sql.rowset.serial.SerialBlob object. There is no way to know for
> sure what will be returned - the entity engine code tries various methods until one works.
>
> I think it would be better to specify exactly what you intend to store in a BLOB SQL type: a byte array, a serialized Java object,
> or some unknown binary type. So, I propose that we add two new field types: byte-array and object. Using Derby as an example, this
> is what it would look like in fieldtypederby.xml:
>
> <field-type-def type="blob" sql-type="BLOB" java-type="java.sql.Blob"></field-type-def>
> <field-type-def type="byte-array" sql-type="BLOB" java-type="byte[]"></field-type-def>
> <field-type-def type="object" sql-type="BLOB" java-type="java.lang.Object"></field-type-def>
>
> Getting an object from each field type would return the respective Java object type.
>
> What do you think?
>
> -Adrian
>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Discussion: New Field Types

Adrian Crum-2
Of course. If the blob field type is used for a byte array or serialized object, it still works but it generates a warning that suggests the correct field type.

-Adrian

--- On Sat, 6/26/10, Jacques Le Roux <[hidden email]> wrote:

> From: Jacques Le Roux <[hidden email]>
> Subject: Re: Discussion: New Field Types
> To: [hidden email]
> Date: Saturday, June 26, 2010, 12:19 PM
> Looks like a good idea to me. I
> suppose you would keep backward compatibility?
>
> Jacques
>
> From: "Adrian Crum" <[hidden email]>
> > The blob field type is being used as a catch-all for
> multiple binary types. Right now getting an object from a
> blob field type
> > could return a byte array, a deserialized Java object,
> or a javax.sql.rowset.serial.SerialBlob object. There is no
> way to know for
> > sure what will be returned - the entity engine code
> tries various methods until one works.
> >
> > I think it would be better to specify exactly what you
> intend to store in a BLOB SQL type: a byte array, a
> serialized Java object,
> > or some unknown binary type. So, I propose that we add
> two new field types: byte-array and object. Using Derby as
> an example, this
> > is what it would look like in fieldtypederby.xml:
> >
> > <field-type-def type="blob" sql-type="BLOB"
> java-type="java.sql.Blob"></field-type-def>
> > <field-type-def type="byte-array" sql-type="BLOB"
> java-type="byte[]"></field-type-def>
> > <field-type-def type="object" sql-type="BLOB"
> java-type="java.lang.Object"></field-type-def>
> >
> > Getting an object from each field type would return
> the respective Java object type.
> >
> > What do you think?
> >
> > -Adrian
> >
> >
> >
> >
> >
>
>
>


     
Reply | Threaded
Open this post in threaded view
|

Re: Discussion: New Field Types: found an error?

hans_bakker
Hi Adrian,

Could it be of the new field types? one of my customers got the
following error when completing an order:

ERROR: Could not complete the Create ShipmentPackageRouteSeg
[file:/E:/workspace/ofbiz959845/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml#createShipmentPackageRouteSeg] process [problem creating the newEntity value: Error while inserting: [GenericEntity:ShipmentPackageRouteSeg][createdStamp,2010-07-05 17:26:17.623(java.sql.Timestamp)][lastUpdatedStamp,2010-07-05 17:26:17.623(java.sql.Timestamp)][lastUpdatedTxStamp,2010-07-05 17:26:17.216(java.sql.Timestamp)][shipmentId,538260(java.lang.String)][shipmentPackageSeqId,00001(java.lang.String)][shipmentRouteSegmentId,00001(java.lang.String)] (SQL Exception while executing the following:INSERT INTO public.SHIPMENT_PACKAGE_ROUTE_SEG (SHIPMENT_ID, SHIPMENT_PACKAGE_SEQ_ID, SHIPMENT_ROUTE_SEGMENT_ID, TRACKING_CODE, BOX_NUMBER, LABEL_IMAGE, LABEL_INTL_SIGN_IMAGE, LABEL_HTML, LABEL_PRINTED, INTERNATIONAL_INVOICE, PACKAGE_TRANSPORT_COST, PACKAGE_SERVICE_COST, PACKAGE_OTHER_COST, COD_AMOUNT, INSURED_AMOUNT, CURRENCY_UOM_ID, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: column "label_image" is of type bytea but expression is of type oid))]
[5:00:12 PM] yasin.lyyas(Virt.village): OFBiz revision number: R959845





On Sun, 2010-06-27 at 07:57 -0700, Adrian Crum wrote:

> Of course. If the blob field type is used for a byte array or serialized object, it still works but it generates a warning that suggests the correct field type.
>
> -Adrian
>
> --- On Sat, 6/26/10, Jacques Le Roux <[hidden email]> wrote:
>
> > From: Jacques Le Roux <[hidden email]>
> > Subject: Re: Discussion: New Field Types
> > To: [hidden email]
> > Date: Saturday, June 26, 2010, 12:19 PM
> > Looks like a good idea to me. I
> > suppose you would keep backward compatibility?
> >
> > Jacques
> >
> > From: "Adrian Crum" <[hidden email]>
> > > The blob field type is being used as a catch-all for
> > multiple binary types. Right now getting an object from a
> > blob field type
> > > could return a byte array, a deserialized Java object,
> > or a javax.sql.rowset.serial.SerialBlob object. There is no
> > way to know for
> > > sure what will be returned - the entity engine code
> > tries various methods until one works.
> > >
> > > I think it would be better to specify exactly what you
> > intend to store in a BLOB SQL type: a byte array, a
> > serialized Java object,
> > > or some unknown binary type. So, I propose that we add
> > two new field types: byte-array and object. Using Derby as
> > an example, this
> > > is what it would look like in fieldtypederby.xml:
> > >
> > > <field-type-def type="blob" sql-type="BLOB"
> > java-type="java.sql.Blob"></field-type-def>
> > > <field-type-def type="byte-array" sql-type="BLOB"
> > java-type="byte[]"></field-type-def>
> > > <field-type-def type="object" sql-type="BLOB"
> > java-type="java.lang.Object"></field-type-def>
> > >
> > > Getting an object from each field type would return
> > the respective Java object type.
> > >
> > > What do you think?
> > >
> > > -Adrian
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
>
>
>      

--
Ofbiz on twitter: http://twitter.com/apache_ofbiz
Myself on twitter: http://twitter.com/hansbak
Antwebsystems.com: Quality services for competitive rates.

Reply | Threaded
Open this post in threaded view
|

Re: Discussion: New Field Types: found an error?

hans_bakker
It is happening with postgres 8.3

On Mon, 2010-07-05 at 17:27 +0700, Hans Bakker wrote:

> Hi Adrian,
>
> Could it be of the new field types? one of my customers got the
> following error when completing an order:
>
> ERROR: Could not complete the Create ShipmentPackageRouteSeg
> [file:/E:/workspace/ofbiz959845/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml#createShipmentPackageRouteSeg] process [problem creating the newEntity value: Error while inserting: [GenericEntity:ShipmentPackageRouteSeg][createdStamp,2010-07-05 17:26:17.623(java.sql.Timestamp)][lastUpdatedStamp,2010-07-05 17:26:17.623(java.sql.Timestamp)][lastUpdatedTxStamp,2010-07-05 17:26:17.216(java.sql.Timestamp)][shipmentId,538260(java.lang.String)][shipmentPackageSeqId,00001(java.lang.String)][shipmentRouteSegmentId,00001(java.lang.String)] (SQL Exception while executing the following:INSERT INTO public.SHIPMENT_PACKAGE_ROUTE_SEG (SHIPMENT_ID, SHIPMENT_PACKAGE_SEQ_ID, SHIPMENT_ROUTE_SEGMENT_ID, TRACKING_CODE, BOX_NUMBER, LABEL_IMAGE, LABEL_INTL_SIGN_IMAGE, LABEL_HTML, LABEL_PRINTED, INTERNATIONAL_INVOICE, PACKAGE_TRANSPORT_COST, PACKAGE_SERVICE_COST, PACKAGE_OTHER_COST, COD_AMOUNT, INSURED_AMOUNT, CURRENCY_UOM_ID, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: column "label_image" is of type bytea but expression is of type oid))]
> [5:00:12 PM] yasin.lyyas(Virt.village): OFBiz revision number: R959845
>
>
>
>
>
> On Sun, 2010-06-27 at 07:57 -0700, Adrian Crum wrote:
> > Of course. If the blob field type is used for a byte array or serialized object, it still works but it generates a warning that suggests the correct field type.
> >
> > -Adrian
> >
> > --- On Sat, 6/26/10, Jacques Le Roux <[hidden email]> wrote:
> >
> > > From: Jacques Le Roux <[hidden email]>
> > > Subject: Re: Discussion: New Field Types
> > > To: [hidden email]
> > > Date: Saturday, June 26, 2010, 12:19 PM
> > > Looks like a good idea to me. I
> > > suppose you would keep backward compatibility?
> > >
> > > Jacques
> > >
> > > From: "Adrian Crum" <[hidden email]>
> > > > The blob field type is being used as a catch-all for
> > > multiple binary types. Right now getting an object from a
> > > blob field type
> > > > could return a byte array, a deserialized Java object,
> > > or a javax.sql.rowset.serial.SerialBlob object. There is no
> > > way to know for
> > > > sure what will be returned - the entity engine code
> > > tries various methods until one works.
> > > >
> > > > I think it would be better to specify exactly what you
> > > intend to store in a BLOB SQL type: a byte array, a
> > > serialized Java object,
> > > > or some unknown binary type. So, I propose that we add
> > > two new field types: byte-array and object. Using Derby as
> > > an example, this
> > > > is what it would look like in fieldtypederby.xml:
> > > >
> > > > <field-type-def type="blob" sql-type="BLOB"
> > > java-type="java.sql.Blob"></field-type-def>
> > > > <field-type-def type="byte-array" sql-type="BLOB"
> > > java-type="byte[]"></field-type-def>
> > > > <field-type-def type="object" sql-type="BLOB"
> > > java-type="java.lang.Object"></field-type-def>
> > > >
> > > > Getting an object from each field type would return
> > > the respective Java object type.
> > > >
> > > > What do you think?
> > > >
> > > > -Adrian
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >      
>

--
Ofbiz on twitter: http://twitter.com/apache_ofbiz
Myself on twitter: http://twitter.com/hansbak
Antwebsystems.com: Quality services for competitive rates.

Reply | Threaded
Open this post in threaded view
|

Re: Discussion: New Field Types: found an error?

Adrian Crum-2
Thanks Hans. I will look into it.

-Adrian

--- On Mon, 7/5/10, Hans Bakker <[hidden email]> wrote:

> From: Hans Bakker <[hidden email]>
> Subject: Re: Discussion: New Field Types: found an error?
> To: [hidden email]
> Date: Monday, July 5, 2010, 3:31 AM
> It is happening with postgres 8.3
>
> On Mon, 2010-07-05 at 17:27 +0700, Hans Bakker wrote:
> > Hi Adrian,
> >
> > Could it be of the new field types? one of my
> customers got the
> > following error when completing an order:
> >
> > ERROR: Could not complete the Create
> ShipmentPackageRouteSeg
> >
> [file:/E:/workspace/ofbiz959845/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml#createShipmentPackageRouteSeg]
> process [problem creating the newEntity value: Error while
> inserting:
> [GenericEntity:ShipmentPackageRouteSeg][createdStamp,2010-07-05
> 17:26:17.623(java.sql.Timestamp)][lastUpdatedStamp,2010-07-05
> 17:26:17.623(java.sql.Timestamp)][lastUpdatedTxStamp,2010-07-05
> 17:26:17.216(java.sql.Timestamp)][shipmentId,538260(java.lang.String)][shipmentPackageSeqId,00001(java.lang.String)][shipmentRouteSegmentId,00001(java.lang.String)]
> (SQL Exception while executing the following:INSERT INTO
> public.SHIPMENT_PACKAGE_ROUTE_SEG (SHIPMENT_ID,
> SHIPMENT_PACKAGE_SEQ_ID, SHIPMENT_ROUTE_SEGMENT_ID,
> TRACKING_CODE, BOX_NUMBER, LABEL_IMAGE,
> LABEL_INTL_SIGN_IMAGE, LABEL_HTML, LABEL_PRINTED,
> INTERNATIONAL_INVOICE, PACKAGE_TRANSPORT_COST,
> PACKAGE_SERVICE_COST, PACKAGE_OTHER_COST, COD_AMOUNT,
> INSURED_AMOUNT, CURRENCY_UOM_ID, LAST_UPDATED_STAMP,
> LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP)
> VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?, ?) (ERROR: column "label_image" is of type bytea but
> expression is of type oid))]
> > [5:00:12 PM] yasin.lyyas(Virt.village): OFBiz revision
> number: R959845
> >
> >
> >
> >
> >
> > On Sun, 2010-06-27 at 07:57 -0700, Adrian Crum wrote:
> > > Of course. If the blob field type is used for a
> byte array or serialized object, it still works but it
> generates a warning that suggests the correct field type.
> > >
> > > -Adrian
> > >
> > > --- On Sat, 6/26/10, Jacques Le Roux <[hidden email]>
> wrote:
> > >
> > > > From: Jacques Le Roux <[hidden email]>
> > > > Subject: Re: Discussion: New Field Types
> > > > To: [hidden email]
> > > > Date: Saturday, June 26, 2010, 12:19 PM
> > > > Looks like a good idea to me. I
> > > > suppose you would keep backward
> compatibility?
> > > >
> > > > Jacques
> > > >
> > > > From: "Adrian Crum" <[hidden email]>
> > > > > The blob field type is being used as a
> catch-all for
> > > > multiple binary types. Right now getting an
> object from a
> > > > blob field type
> > > > > could return a byte array, a
> deserialized Java object,
> > > > or a javax.sql.rowset.serial.SerialBlob
> object. There is no
> > > > way to know for
> > > > > sure what will be returned - the entity
> engine code
> > > > tries various methods until one works.
> > > > >
> > > > > I think it would be better to specify
> exactly what you
> > > > intend to store in a BLOB SQL type: a byte
> array, a
> > > > serialized Java object,
> > > > > or some unknown binary type. So, I
> propose that we add
> > > > two new field types: byte-array and object.
> Using Derby as
> > > > an example, this
> > > > > is what it would look like in
> fieldtypederby.xml:
> > > > >
> > > > > <field-type-def type="blob"
> sql-type="BLOB"
> > > >
> java-type="java.sql.Blob"></field-type-def>
> > > > > <field-type-def type="byte-array"
> sql-type="BLOB"
> > > >
> java-type="byte[]"></field-type-def>
> > > > > <field-type-def type="object"
> sql-type="BLOB"
> > > >
> java-type="java.lang.Object"></field-type-def>
> > > > >
> > > > > Getting an object from each field type
> would return
> > > > the respective Java object type.
> > > > >
> > > > > What do you think?
> > > > >
> > > > > -Adrian
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >       
> >
>
> --
> Ofbiz on twitter: http://twitter.com/apache_ofbiz
> Myself on twitter: http://twitter.com/hansbak
> Antwebsystems.com: Quality services for competitive rates.
>
>


     
Reply | Threaded
Open this post in threaded view
|

Re: Discussion: New Field Types: found an error?

Adrian Crum-2
Hans,

I need more information. Could you provide a complete stack trace please? Also, you mentioned the new field types - did you change your fieldtype*.xml to use them? If so, I need to see the contents of that file.

-Adrian

--- On Mon, 7/5/10, Adrian Crum <[hidden email]> wrote:

> From: Adrian Crum <[hidden email]>
> Subject: Re: Discussion: New Field Types: found an error?
> To: [hidden email]
> Date: Monday, July 5, 2010, 7:31 AM
> Thanks Hans. I will look into it.
>
> -Adrian
>
> --- On Mon, 7/5/10, Hans Bakker <[hidden email]>
> wrote:
>
> > From: Hans Bakker <[hidden email]>
> > Subject: Re: Discussion: New Field Types: found an
> error?
> > To: [hidden email]
> > Date: Monday, July 5, 2010, 3:31 AM
> > It is happening with postgres 8.3
> >
> > On Mon, 2010-07-05 at 17:27 +0700, Hans Bakker wrote:
> > > Hi Adrian,
> > >
> > > Could it be of the new field types? one of my
> > customers got the
> > > following error when completing an order:
> > >
> > > ERROR: Could not complete the Create
> > ShipmentPackageRouteSeg
> > >
> >
> [file:/E:/workspace/ofbiz959845/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml#createShipmentPackageRouteSeg]
> > process [problem creating the newEntity value: Error
> while
> > inserting:
> >
> [GenericEntity:ShipmentPackageRouteSeg][createdStamp,2010-07-05
> >
> 17:26:17.623(java.sql.Timestamp)][lastUpdatedStamp,2010-07-05
> >
> 17:26:17.623(java.sql.Timestamp)][lastUpdatedTxStamp,2010-07-05
> >
> 17:26:17.216(java.sql.Timestamp)][shipmentId,538260(java.lang.String)][shipmentPackageSeqId,00001(java.lang.String)][shipmentRouteSegmentId,00001(java.lang.String)]
> > (SQL Exception while executing the following:INSERT
> INTO
> > public.SHIPMENT_PACKAGE_ROUTE_SEG (SHIPMENT_ID,
> > SHIPMENT_PACKAGE_SEQ_ID, SHIPMENT_ROUTE_SEGMENT_ID,
> > TRACKING_CODE, BOX_NUMBER, LABEL_IMAGE,
> > LABEL_INTL_SIGN_IMAGE, LABEL_HTML, LABEL_PRINTED,
> > INTERNATIONAL_INVOICE, PACKAGE_TRANSPORT_COST,
> > PACKAGE_SERVICE_COST, PACKAGE_OTHER_COST, COD_AMOUNT,
> > INSURED_AMOUNT, CURRENCY_UOM_ID, LAST_UPDATED_STAMP,
> > LAST_UPDATED_TX_STAMP, CREATED_STAMP,
> CREATED_TX_STAMP)
> > VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?,
> > ?, ?, ?) (ERROR: column "label_image" is of type bytea
> but
> > expression is of type oid))]
> > > [5:00:12 PM] yasin.lyyas(Virt.village): OFBiz
> revision
> > number: R959845
> > >
> > >
> > >
> > >
> > >
> > > On Sun, 2010-06-27 at 07:57 -0700, Adrian Crum
> wrote:
> > > > Of course. If the blob field type is used
> for a
> > byte array or serialized object, it still works but
> it
> > generates a warning that suggests the correct field
> type.
> > > >
> > > > -Adrian
> > > >
> > > > --- On Sat, 6/26/10, Jacques Le Roux <[hidden email]>
> > wrote:
> > > >
> > > > > From: Jacques Le Roux <[hidden email]>
> > > > > Subject: Re: Discussion: New Field
> Types
> > > > > To: [hidden email]
> > > > > Date: Saturday, June 26, 2010, 12:19
> PM
> > > > > Looks like a good idea to me. I
> > > > > suppose you would keep backward
> > compatibility?
> > > > >
> > > > > Jacques
> > > > >
> > > > > From: "Adrian Crum" <[hidden email]>
> > > > > > The blob field type is being used
> as a
> > catch-all for
> > > > > multiple binary types. Right now
> getting an
> > object from a
> > > > > blob field type
> > > > > > could return a byte array, a
> > deserialized Java object,
> > > > > or a
> javax.sql.rowset.serial.SerialBlob
> > object. There is no
> > > > > way to know for
> > > > > > sure what will be returned - the
> entity
> > engine code
> > > > > tries various methods until one works.
> > > > > >
> > > > > > I think it would be better to
> specify
> > exactly what you
> > > > > intend to store in a BLOB SQL type: a
> byte
> > array, a
> > > > > serialized Java object,
> > > > > > or some unknown binary type. So,
> I
> > propose that we add
> > > > > two new field types: byte-array and
> object.
> > Using Derby as
> > > > > an example, this
> > > > > > is what it would look like in
> > fieldtypederby.xml:
> > > > > >
> > > > > > <field-type-def type="blob"
> > sql-type="BLOB"
> > > > >
> > java-type="java.sql.Blob"></field-type-def>
> > > > > > <field-type-def
> type="byte-array"
> > sql-type="BLOB"
> > > > >
> > java-type="byte[]"></field-type-def>
> > > > > > <field-type-def type="object"
> > sql-type="BLOB"
> > > > >
> >
> java-type="java.lang.Object"></field-type-def>
> > > > > >
> > > > > > Getting an object from each field
> type
> > would return
> > > > > the respective Java object type.
> > > > > >
> > > > > > What do you think?
> > > > > >
> > > > > > -Adrian
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >       
> > >
> >
> > --
> > Ofbiz on twitter: http://twitter.com/apache_ofbiz
> > Myself on twitter: http://twitter.com/hansbak
> > Antwebsystems.com: Quality services for competitive
> rates.
> >
> >
>
>
>      
>



Reply | Threaded
Open this post in threaded view
|

Re: Discussion: New Field Types: found an error?

Adrian Crum-2
In reply to this post by Adrian Crum-2
Hans,

Try inserting this line in JdbcValueHandler.java, at line 135:

result.put("BYTEA", Types.BINARY);

and let me know if that fixes the problem.

-Adrian

--- On Mon, 7/5/10, Adrian Crum <[hidden email]> wrote:

> From: Adrian Crum <[hidden email]>
> Subject: Re: Discussion: New Field Types: found an error?
> To: [hidden email]
> Date: Monday, July 5, 2010, 7:31 AM
> Thanks Hans. I will look into it.
>
> -Adrian
>
> --- On Mon, 7/5/10, Hans Bakker <[hidden email]>
> wrote:
>
> > From: Hans Bakker <[hidden email]>
> > Subject: Re: Discussion: New Field Types: found an
> error?
> > To: [hidden email]
> > Date: Monday, July 5, 2010, 3:31 AM
> > It is happening with postgres 8.3
> >
> > On Mon, 2010-07-05 at 17:27 +0700, Hans Bakker wrote:
> > > Hi Adrian,
> > >
> > > Could it be of the new field types? one of my
> > customers got the
> > > following error when completing an order:
> > >
> > > ERROR: Could not complete the Create
> > ShipmentPackageRouteSeg
> > >
> >
> [file:/E:/workspace/ofbiz959845/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml#createShipmentPackageRouteSeg]
> > process [problem creating the newEntity value: Error
> while
> > inserting:
> >
> [GenericEntity:ShipmentPackageRouteSeg][createdStamp,2010-07-05
> >
> 17:26:17.623(java.sql.Timestamp)][lastUpdatedStamp,2010-07-05
> >
> 17:26:17.623(java.sql.Timestamp)][lastUpdatedTxStamp,2010-07-05
> >
> 17:26:17.216(java.sql.Timestamp)][shipmentId,538260(java.lang.String)][shipmentPackageSeqId,00001(java.lang.String)][shipmentRouteSegmentId,00001(java.lang.String)]
> > (SQL Exception while executing the following:INSERT
> INTO
> > public.SHIPMENT_PACKAGE_ROUTE_SEG (SHIPMENT_ID,
> > SHIPMENT_PACKAGE_SEQ_ID, SHIPMENT_ROUTE_SEGMENT_ID,
> > TRACKING_CODE, BOX_NUMBER, LABEL_IMAGE,
> > LABEL_INTL_SIGN_IMAGE, LABEL_HTML, LABEL_PRINTED,
> > INTERNATIONAL_INVOICE, PACKAGE_TRANSPORT_COST,
> > PACKAGE_SERVICE_COST, PACKAGE_OTHER_COST, COD_AMOUNT,
> > INSURED_AMOUNT, CURRENCY_UOM_ID, LAST_UPDATED_STAMP,
> > LAST_UPDATED_TX_STAMP, CREATED_STAMP,
> CREATED_TX_STAMP)
> > VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?,
> > ?, ?, ?) (ERROR: column "label_image" is of type bytea
> but
> > expression is of type oid))]
> > > [5:00:12 PM] yasin.lyyas(Virt.village): OFBiz
> revision
> > number: R959845
> > >
> > >
> > >
> > >
> > >
> > > On Sun, 2010-06-27 at 07:57 -0700, Adrian Crum
> wrote:
> > > > Of course. If the blob field type is used
> for a
> > byte array or serialized object, it still works but
> it
> > generates a warning that suggests the correct field
> type.
> > > >
> > > > -Adrian
> > > >
> > > > --- On Sat, 6/26/10, Jacques Le Roux <[hidden email]>
> > wrote:
> > > >
> > > > > From: Jacques Le Roux <[hidden email]>
> > > > > Subject: Re: Discussion: New Field
> Types
> > > > > To: [hidden email]
> > > > > Date: Saturday, June 26, 2010, 12:19
> PM
> > > > > Looks like a good idea to me. I
> > > > > suppose you would keep backward
> > compatibility?
> > > > >
> > > > > Jacques
> > > > >
> > > > > From: "Adrian Crum" <[hidden email]>
> > > > > > The blob field type is being used
> as a
> > catch-all for
> > > > > multiple binary types. Right now
> getting an
> > object from a
> > > > > blob field type
> > > > > > could return a byte array, a
> > deserialized Java object,
> > > > > or a
> javax.sql.rowset.serial.SerialBlob
> > object. There is no
> > > > > way to know for
> > > > > > sure what will be returned - the
> entity
> > engine code
> > > > > tries various methods until one works.
> > > > > >
> > > > > > I think it would be better to
> specify
> > exactly what you
> > > > > intend to store in a BLOB SQL type: a
> byte
> > array, a
> > > > > serialized Java object,
> > > > > > or some unknown binary type. So,
> I
> > propose that we add
> > > > > two new field types: byte-array and
> object.
> > Using Derby as
> > > > > an example, this
> > > > > > is what it would look like in
> > fieldtypederby.xml:
> > > > > >
> > > > > > <field-type-def type="blob"
> > sql-type="BLOB"
> > > > >
> > java-type="java.sql.Blob"></field-type-def>
> > > > > > <field-type-def
> type="byte-array"
> > sql-type="BLOB"
> > > > >
> > java-type="byte[]"></field-type-def>
> > > > > > <field-type-def type="object"
> > sql-type="BLOB"
> > > > >
> >
> java-type="java.lang.Object"></field-type-def>
> > > > > >
> > > > > > Getting an object from each field
> type
> > would return
> > > > > the respective Java object type.
> > > > > >
> > > > > > What do you think?
> > > > > >
> > > > > > -Adrian
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >       
> > >
> >
> > --
> > Ofbiz on twitter: http://twitter.com/apache_ofbiz
> > Myself on twitter: http://twitter.com/hansbak
> > Antwebsystems.com: Quality services for competitive
> rates.
> >
> >
>
>
>      
>



Reply | Threaded
Open this post in threaded view
|

Re: Discussion: New Field Types: found an error?

hans_bakker
Hi Arian,

Thanks for the quick reply and quick fix.
Asked customer, they tested it and it worked fine!

regards,
Hans

On Mon, 2010-07-05 at 08:15 -0700, Adrian Crum wrote:

> Hans,
>
> Try inserting this line in JdbcValueHandler.java, at line 135:
>
> result.put("BYTEA", Types.BINARY);
>
> and let me know if that fixes the problem.
>
> -Adrian
>
> --- On Mon, 7/5/10, Adrian Crum <[hidden email]> wrote:
>
> > From: Adrian Crum <[hidden email]>
> > Subject: Re: Discussion: New Field Types: found an error?
> > To: [hidden email]
> > Date: Monday, July 5, 2010, 7:31 AM
> > Thanks Hans. I will look into it.
> >
> > -Adrian
> >
> > --- On Mon, 7/5/10, Hans Bakker <[hidden email]>
> > wrote:
> >
> > > From: Hans Bakker <[hidden email]>
> > > Subject: Re: Discussion: New Field Types: found an
> > error?
> > > To: [hidden email]
> > > Date: Monday, July 5, 2010, 3:31 AM
> > > It is happening with postgres 8.3
> > >
> > > On Mon, 2010-07-05 at 17:27 +0700, Hans Bakker wrote:
> > > > Hi Adrian,
> > > >
> > > > Could it be of the new field types? one of my
> > > customers got the
> > > > following error when completing an order:
> > > >
> > > > ERROR: Could not complete the Create
> > > ShipmentPackageRouteSeg
> > > >
> > >
> > [file:/E:/workspace/ofbiz959845/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml#createShipmentPackageRouteSeg]
> > > process [problem creating the newEntity value: Error
> > while
> > > inserting:
> > >
> > [GenericEntity:ShipmentPackageRouteSeg][createdStamp,2010-07-05
> > >
> > 17:26:17.623(java.sql.Timestamp)][lastUpdatedStamp,2010-07-05
> > >
> > 17:26:17.623(java.sql.Timestamp)][lastUpdatedTxStamp,2010-07-05
> > >
> > 17:26:17.216(java.sql.Timestamp)][shipmentId,538260(java.lang.String)][shipmentPackageSeqId,00001(java.lang.String)][shipmentRouteSegmentId,00001(java.lang.String)]
> > > (SQL Exception while executing the following:INSERT
> > INTO
> > > public.SHIPMENT_PACKAGE_ROUTE_SEG (SHIPMENT_ID,
> > > SHIPMENT_PACKAGE_SEQ_ID, SHIPMENT_ROUTE_SEGMENT_ID,
> > > TRACKING_CODE, BOX_NUMBER, LABEL_IMAGE,
> > > LABEL_INTL_SIGN_IMAGE, LABEL_HTML, LABEL_PRINTED,
> > > INTERNATIONAL_INVOICE, PACKAGE_TRANSPORT_COST,
> > > PACKAGE_SERVICE_COST, PACKAGE_OTHER_COST, COD_AMOUNT,
> > > INSURED_AMOUNT, CURRENCY_UOM_ID, LAST_UPDATED_STAMP,
> > > LAST_UPDATED_TX_STAMP, CREATED_STAMP,
> > CREATED_TX_STAMP)
> > > VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> > ?, ?,
> > > ?, ?, ?) (ERROR: column "label_image" is of type bytea
> > but
> > > expression is of type oid))]
> > > > [5:00:12 PM] yasin.lyyas(Virt.village): OFBiz
> > revision
> > > number: R959845
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Sun, 2010-06-27 at 07:57 -0700, Adrian Crum
> > wrote:
> > > > > Of course. If the blob field type is used
> > for a
> > > byte array or serialized object, it still works but
> > it
> > > generates a warning that suggests the correct field
> > type.
> > > > >
> > > > > -Adrian
> > > > >
> > > > > --- On Sat, 6/26/10, Jacques Le Roux <[hidden email]>
> > > wrote:
> > > > >
> > > > > > From: Jacques Le Roux <[hidden email]>
> > > > > > Subject: Re: Discussion: New Field
> > Types
> > > > > > To: [hidden email]
> > > > > > Date: Saturday, June 26, 2010, 12:19
> > PM
> > > > > > Looks like a good idea to me. I
> > > > > > suppose you would keep backward
> > > compatibility?
> > > > > >
> > > > > > Jacques
> > > > > >
> > > > > > From: "Adrian Crum" <[hidden email]>
> > > > > > > The blob field type is being used
> > as a
> > > catch-all for
> > > > > > multiple binary types. Right now
> > getting an
> > > object from a
> > > > > > blob field type
> > > > > > > could return a byte array, a
> > > deserialized Java object,
> > > > > > or a
> > javax.sql.rowset.serial.SerialBlob
> > > object. There is no
> > > > > > way to know for
> > > > > > > sure what will be returned - the
> > entity
> > > engine code
> > > > > > tries various methods until one works.
> > > > > > >
> > > > > > > I think it would be better to
> > specify
> > > exactly what you
> > > > > > intend to store in a BLOB SQL type: a
> > byte
> > > array, a
> > > > > > serialized Java object,
> > > > > > > or some unknown binary type. So,
> > I
> > > propose that we add
> > > > > > two new field types: byte-array and
> > object.
> > > Using Derby as
> > > > > > an example, this
> > > > > > > is what it would look like in
> > > fieldtypederby.xml:
> > > > > > >
> > > > > > > <field-type-def type="blob"
> > > sql-type="BLOB"
> > > > > >
> > > java-type="java.sql.Blob"></field-type-def>
> > > > > > > <field-type-def
> > type="byte-array"
> > > sql-type="BLOB"
> > > > > >
> > > java-type="byte[]"></field-type-def>
> > > > > > > <field-type-def type="object"
> > > sql-type="BLOB"
> > > > > >
> > >
> > java-type="java.lang.Object"></field-type-def>
> > > > > > >
> > > > > > > Getting an object from each field
> > type
> > > would return
> > > > > > the respective Java object type.
> > > > > > >
> > > > > > > What do you think?
> > > > > > >
> > > > > > > -Adrian
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >      
> > > >
> > >
> > > --
> > > Ofbiz on twitter: http://twitter.com/apache_ofbiz
> > > Myself on twitter: http://twitter.com/hansbak
> > > Antwebsystems.com: Quality services for competitive
> > rates.
> > >
> > >
> >
> >
> >      
> >
>
>
>      

--
Ofbiz on twitter: http://twitter.com/apache_ofbiz
Myself on twitter: http://twitter.com/hansbak
Antwebsystems.com: Quality services for competitive rates.

Reply | Threaded
Open this post in threaded view
|

Re: Discussion: New Field Types: found an error?

Adrian Crum-2
Cool - I will have a better fix committed to the trunk soon.

-Adrian

--- On Tue, 7/6/10, Hans Bakker <[hidden email]> wrote:

> From: Hans Bakker <[hidden email]>
> Subject: Re: Discussion: New Field Types: found an error?
> To: [hidden email]
> Date: Tuesday, July 6, 2010, 12:55 AM
> Hi Arian,
>
> Thanks for the quick reply and quick fix.
> Asked customer, they tested it and it worked fine!
>
> regards,
> Hans
>
> On Mon, 2010-07-05 at 08:15 -0700, Adrian Crum wrote:
> > Hans,
> >
> > Try inserting this line in JdbcValueHandler.java, at
> line 135:
> >
> > result.put("BYTEA", Types.BINARY);
> >
> > and let me know if that fixes the problem.
> >
> > -Adrian
> >
> > --- On Mon, 7/5/10, Adrian Crum <[hidden email]>
> wrote:
> >
> > > From: Adrian Crum <[hidden email]>
> > > Subject: Re: Discussion: New Field Types: found
> an error?
> > > To: [hidden email]
> > > Date: Monday, July 5, 2010, 7:31 AM
> > > Thanks Hans. I will look into it.
> > >
> > > -Adrian
> > >
> > > --- On Mon, 7/5/10, Hans Bakker <[hidden email]>
> > > wrote:
> > >
> > > > From: Hans Bakker <[hidden email]>
> > > > Subject: Re: Discussion: New Field Types:
> found an
> > > error?
> > > > To: [hidden email]
> > > > Date: Monday, July 5, 2010, 3:31 AM
> > > > It is happening with postgres 8.3
> > > >
> > > > On Mon, 2010-07-05 at 17:27 +0700, Hans
> Bakker wrote:
> > > > > Hi Adrian,
> > > > >
> > > > > Could it be of the new field types? one
> of my
> > > > customers got the
> > > > > following error when completing an
> order:
> > > > >
> > > > > ERROR: Could not complete the Create
> > > > ShipmentPackageRouteSeg
> > > > >
> > > >
> > >
> [file:/E:/workspace/ofbiz959845/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml#createShipmentPackageRouteSeg]
> > > > process [problem creating the newEntity
> value: Error
> > > while
> > > > inserting:
> > > >
> > >
> [GenericEntity:ShipmentPackageRouteSeg][createdStamp,2010-07-05
> > > >
> > >
> 17:26:17.623(java.sql.Timestamp)][lastUpdatedStamp,2010-07-05
> > > >
> > >
> 17:26:17.623(java.sql.Timestamp)][lastUpdatedTxStamp,2010-07-05
> > > >
> > >
> 17:26:17.216(java.sql.Timestamp)][shipmentId,538260(java.lang.String)][shipmentPackageSeqId,00001(java.lang.String)][shipmentRouteSegmentId,00001(java.lang.String)]
> > > > (SQL Exception while executing the
> following:INSERT
> > > INTO
> > > > public.SHIPMENT_PACKAGE_ROUTE_SEG
> (SHIPMENT_ID,
> > > > SHIPMENT_PACKAGE_SEQ_ID,
> SHIPMENT_ROUTE_SEGMENT_ID,
> > > > TRACKING_CODE, BOX_NUMBER, LABEL_IMAGE,
> > > > LABEL_INTL_SIGN_IMAGE, LABEL_HTML,
> LABEL_PRINTED,
> > > > INTERNATIONAL_INVOICE,
> PACKAGE_TRANSPORT_COST,
> > > > PACKAGE_SERVICE_COST, PACKAGE_OTHER_COST,
> COD_AMOUNT,
> > > > INSURED_AMOUNT, CURRENCY_UOM_ID,
> LAST_UPDATED_STAMP,
> > > > LAST_UPDATED_TX_STAMP, CREATED_STAMP,
> > > CREATED_TX_STAMP)
> > > > VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?, ?,
> > > ?, ?,
> > > > ?, ?, ?) (ERROR: column "label_image" is of
> type bytea
> > > but
> > > > expression is of type oid))]
> > > > > [5:00:12 PM] yasin.lyyas(Virt.village):
> OFBiz
> > > revision
> > > > number: R959845
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Sun, 2010-06-27 at 07:57 -0700,
> Adrian Crum
> > > wrote:
> > > > > > Of course. If the blob field type
> is used
> > > for a
> > > > byte array or serialized object, it still
> works but
> > > it
> > > > generates a warning that suggests the
> correct field
> > > type.
> > > > > >
> > > > > > -Adrian
> > > > > >
> > > > > > --- On Sat, 6/26/10, Jacques Le
> Roux <[hidden email]>
> > > > wrote:
> > > > > >
> > > > > > > From: Jacques Le Roux <[hidden email]>
> > > > > > > Subject: Re: Discussion: New
> Field
> > > Types
> > > > > > > To: [hidden email]
> > > > > > > Date: Saturday, June 26,
> 2010, 12:19
> > > PM
> > > > > > > Looks like a good idea to me.
> I
> > > > > > > suppose you would keep
> backward
> > > > compatibility?
> > > > > > >
> > > > > > > Jacques
> > > > > > >
> > > > > > > From: "Adrian Crum" <[hidden email]>
> > > > > > > > The blob field type is
> being used
> > > as a
> > > > catch-all for
> > > > > > > multiple binary types. Right
> now
> > > getting an
> > > > object from a
> > > > > > > blob field type
> > > > > > > > could return a byte
> array, a
> > > > deserialized Java object,
> > > > > > > or a
> > > javax.sql.rowset.serial.SerialBlob
> > > > object. There is no
> > > > > > > way to know for
> > > > > > > > sure what will be
> returned - the
> > > entity
> > > > engine code
> > > > > > > tries various methods until
> one works.
> > > > > > > >
> > > > > > > > I think it would be
> better to
> > > specify
> > > > exactly what you
> > > > > > > intend to store in a BLOB SQL
> type: a
> > > byte
> > > > array, a
> > > > > > > serialized Java object,
> > > > > > > > or some unknown binary
> type. So,
> > > I
> > > > propose that we add
> > > > > > > two new field types:
> byte-array and
> > > object.
> > > > Using Derby as
> > > > > > > an example, this
> > > > > > > > is what it would look
> like in
> > > > fieldtypederby.xml:
> > > > > > > >
> > > > > > > > <field-type-def
> type="blob"
> > > > sql-type="BLOB"
> > > > > > >
> > > >
> java-type="java.sql.Blob"></field-type-def>
> > > > > > > > <field-type-def
> > > type="byte-array"
> > > > sql-type="BLOB"
> > > > > > >
> > > >
> java-type="byte[]"></field-type-def>
> > > > > > > > <field-type-def
> type="object"
> > > > sql-type="BLOB"
> > > > > > >
> > > >
> > >
> java-type="java.lang.Object"></field-type-def>
> > > > > > > >
> > > > > > > > Getting an object from
> each field
> > > type
> > > > would return
> > > > > > > the respective Java object
> type.
> > > > > > > >
> > > > > > > > What do you think?
> > > > > > > >
> > > > > > > > -Adrian
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >       
> > > > >
> > > >
> > > > --
> > > > Ofbiz on twitter: http://twitter.com/apache_ofbiz
> > > > Myself on twitter: http://twitter.com/hansbak
> > > > Antwebsystems.com: Quality services for
> competitive
> > > rates.
> > > >
> > > >
> > >
> > >
> > >     
> > >
> >
> >
> >       
>
> --
> Ofbiz on twitter: http://twitter.com/apache_ofbiz
> Myself on twitter: http://twitter.com/hansbak
> Antwebsystems.com: Quality services for competitive rates.
>
>