Taher

Thanks for the response.  To answer your questions:

1. It occurs only for a certain field inside a certain table?
Yes, it only occurs for the description field in the VendingMachinePack table.  
All other fields in the VendingMachinePack table persist successfully and 
description fields in other tables (eg: description field in the ReturnItem 
table) all persist successfully.

2.  It occurs only on postgres?
Unknown.  I am restricted to using postgres.

3.  It occurs only when you persist? (i.e. the GenericValue is okay)
Yes, System.out.println lines show the description field correctly, but viewing 
the table using Webtools after the write show the description field as blank.  
Eg:
GenericValue newPack = delegator.makeValue("VendingMachinePack", input);
System.out.println("Have Pack = " + newPack);
toStore.add(newPack);
delegator.storeAll(toStore);
System.out.println("Have description " + newPack.getString("description"));

Results of the above code in the console.log file show the description field 
correct in both the GenericValue.toString() and 
newPack.getString("description").

However, when going to Webtools immediatly following the database write, the 
description field (and the description field alone) is blank.

A strange problem.

Thanks again.

Skip

-----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