Hi Skip,

I don't if you have tried this but I have a suggestion.


Why don't you put a debug point in org.ofbiz.entity.jdbc.SQLProcessor class at 
executeUpdate() method(as per my version of Ofbiz 12). At the line return 
_ps.executeUpdate(). The _ps here is the prepared statement and it will give 
you the insert statement which is being executed to persist this data.


Take a look at the sql which you get for inserting into VendingMachinePack 
entity here. In case it has all the data at the description column, try 
executing the insert query using the pgadmin to see if the data persists in 
postgres.


Regards,

Arun Sankar

________________________________
From: Skip <[email protected]>
Sent: Friday, May 12, 2017 12:55:01 AM
To: [email protected]
Subject: RE: Problem with description field

Hi again Taher

I wanted to add one more interesting observation.  As a test, I added a field 
"desc2" with the exact same declaration in the entity declaration.  Then, in 
the code:

Map input = UtilMisc.toMap(...);
nput.put("description", description);
input.put("desc2", description);


Interestingly, the desc2 field persists correctly, but the description field 
does not.

For completeness, here is the entity definition (with the greater/less than 
characters removed):

entity entity-name="VendingMachinePack"
package-name="com.fs.vending"
title="A package of products of the same type dispensed as a single item."
  field name="packageId" type="id-long"
    description This is the productId + ( + vendQty + ) + [5 digit number] 
description
  field
field name="upc" type="id-ne"field
field name="vendingMachingId" type="id-ne"
    description The vending machine this pack is destined for. description
field
  field name="productId" type="id"
    description The productId.  Is never emptydescription
  field
  field name="inventoryItemId" type="id"
    description This can be empty until pulled.  description
  field
field name="description" type="description"
    description This is by default the Product-description, but it can (and 
usually should be changed to allow clear vending machine 
descriptions.description
field
field name="desc2" type="description"
    description Duplicate of description.  Having problems getting description 
above to save.description
field
  field name="aisleNumber" type="numeric"
    descriptionThis is a number that contains the machine number row and aisle 
number starting with 1.
    This is the proposed or actual number.  Proposed until it is installed in 
the machine.
    It is computed as ((slaveNumber - 1) * 100) + ((rowNumber - 1) * 10) + 
aisleNumber.
    There can be a maximum of 9 slaves, 9 rows and 10 aisles.
    Get aisle number as int aisle = (aisleNumber - 1) % 10); for a zero based 
aisle
    Get row number as int row = ((aisleNumber - 1) % 100)  (int)10; for a zero 
based row
    Get machine number as return (int)(aisleNumber  (int)100);
    description
  field
field name="totalAvailable" type="fixed-point"
    descriptionThe total number of packs (vendQty) that will fit in an 
Aisledescription
field
field name="minimumQty" type="fixed-point"
    descriptionThe number that will cause a priority reorder if 
reacheddescription
field
    field name="packageCount" type="numeric"  !-- The number of of packs 
(usually 1 item per pack) --
    field name="isInstalled" type="indicator"  !-- Y if the pack is installed 
in the machine --
  field name="installedTimestamp" type="date-time"
  field name="installedaisle" type="numeric"
    descriptionThis is the aisle number the product was actually installed 
in.description
  field
field name="vendQty" type="fixed-point"
    descriptionThis is the quantity dispensed with each transaction and is the 
pack quantity.  It is not the Product.packageQtydescription
field
prim-key field="packageId"
relation type="one" title="VMPackProduct" rel-entity-name="Product"
      key-map field-name="productId"
relation
entity



-----Original Message-----
From: Taher Alkhateeb [mailto:[email protected]]
Sent: Thursday, May 11, 2017 3:05 AM
To: [email protected]
Subject: Re: Problem with description field


Hi Skip,

So what I understand from you so far is the following regarding this bug:
- It occurs only for a certain field inside a certain table?
- It occurs only on postgres?
- It occurs only when you persist? (i.e. the GenericValue is okay)

Can you confirm this much?

Regards,

On Wed, May 10, 2017 at 10:08 PM, Skip <[email protected]> wrote:

> Thanks Jeremy
>
> That was a typo.  It is actually description (lower case).  I also took
> the time to compare the description fields in ReturnItem and
> VendingMachinePack in pgAdmin and they are identical except for Position.
>
> Also, because I can put data in this field using WebTools, I don't think
> the issue is in postgres.
>
> I have written hundreds of custom services for ofbiz and millions of lines
> of java code.  This particular service is different in one regard.
>
> Usually, I write these kinds of services like this:
>
> transaction.begin
>         add new or modified  records to a "toStore" iist
>         delegator.storeAll(toStore);
> transaction.commit
>
> This one is different because I am modifying InventoryItem records in a
> loop like this
>
> transaction.begin
>         get count of inventory items needed
>         while count > 0
>                 get inventory item and reduce count by availabletopromise
>                 modify inventoryItem record and put in toStore
>                 create a VendingMachinePack and other entities and add to
> toStore
>                 delegator.storeAll(toStore);
>         endwhile
> transaction.commit
>
> So, as you can see, there can be multiple delegator.storeAll() calls in a
> single transaction.  However, I have spent three days testing this and I
> can pick a product where a single inventoryItem exists that can fullfil the
> request and the results are the same.
>
> Thanks again for thinking about this very strange issue.
>
> Skip
>
>
>
> -----Original Message-----
> From: Jeremy Olmstead [mailto:[email protected]]
> Sent: Wednesday, May 10, 2017 11:00 AM
> To: [email protected]
> Subject: Re: Problem with description field
>
>
> This is a long shot but, in your statement below, description is spelled
> incorrectly...
>
> Looking at the table with pgAdmin (I am using postgres), I find the field
> DESCRITPTION as expected, but it is empty.
>
> On Tue, May 9, 2017 at 7:33 PM, Skip <[email protected]> wrote:
>
> > I have a problem with a field named "description".  The problem is that
> > when
> > I write to this field, it never ends up in the database.
> >
> > The entity definition looks like this:
> >
> >    <entity entity-name="VendingMachinePack"
> > ...
> >         field name="description" type="description"
> >         field name="descAgain" type="description"
> > ...
> >
> > I write to the field like this:
> >
> > Map input = UtilMisc.toMap(...);
> > input.put("description", description);
> > input.put("descAgain", description);
> >
> > ...
> > GenericValue newPack = delegator.makeValue("VendingMachinePack", input);
> > System.out.println("Have Pack = " + newPack);
> > //newPack.create();
> > toStore.add(newPack);
> >
> > System.out.println("Have description " + newPack.getString("
> > description"));
> >
> > ....
> >
> > delegator.storeAll(toStore);
> >
> > My log file shows the correct description from the
> System.out.println("Have
> > description " statement.
> >
> > However, looking at the table using WebTools, the description field is
> > EMPTY!!!
> >
> > I added a second description field called "descAgain" and this shows up
> > fine
> > as well as all the other 20 fields in the table.  Just the description
> > field
> > is empty.
> >
> > There are dozens of uses of "description" as a field name.
> >
> > Looking at the table with pgAdmin (I am using postgres), I find the field
> > DESCRITPTION as expected, but it is empty.
> >
> > I have tried deleting the table with pgAdmin and having it automatically
> > recreated.  As can be seen above, I have tried calling newPack.create();
> > instead of delegator.storeAll(toStore); as well as a bunch of other
> stuff.
> >
> > Nothing I have tried has any effect on "description" this field.
> >
> > My log file has no errors.
> >
> > Anyone have any ideas on what might be going on?
> >
> > Skip
> >
> >
>
>

Reply via email to