Problem with description field

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

Problem with description field

SkipDever
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 | Threaded
Open this post in threaded view
|

Re: Problem with description field

Paul Foxworthy
Hi Skip,

Try it with Derby instead of Postgres. Postgres handles large text
differently from other databases, arguably better. Maybe OFBiz isn't doing
the right thing for Postgres. What's the Postgres data type for the
description columns?

Cheers

Paul Foxworthy


On 10 May 2017 at 10:33, Skip <[hidden email]> 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
>
>


--
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192
Australia

Phone: +61 3 9585 6788
Web: http://www.coherentsoftware.com.au/
Email: [hidden email]
--
Coherent Software Australia Pty Ltd
http://www.coherentsoftware.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/
Reply | Threaded
Open this post in threaded view
|

Re: Problem with description field

Arun Sankar

Hi Skip,


Can you share the version of Postgres which you are using. I am using Postgres in my current project and have not experienced such an issue.


We use <field name="description" type="description"></field> on multiple entities in ofbiz such as Product, InvoiceItem, Facility etc in Ofbiz.


Also I would suggest to create an Invoice and check the Description field on the Invoice item. This would help to further understand whether this really is an issue with using the name description.


Regards,

Arun Sankar

________________________________
From: Paul Foxworthy <[hidden email]>
Sent: Wednesday, May 10, 2017 7:28:17 AM
To: [hidden email]
Subject: Re: Problem with description field

Hi Skip,

Try it with Derby instead of Postgres. Postgres handles large text
differently from other databases, arguably better. Maybe OFBiz isn't doing
the right thing for Postgres. What's the Postgres data type for the
description columns?

Cheers

Paul Foxworthy


On 10 May 2017 at 10:33, Skip <[hidden email]> 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
>
>


--
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192
Australia

Phone: +61 3 9585 6788
Web: http://www.coherentsoftware.com.au/
Coherent Software - Custom software,web application and ...<http://www.coherentsoftware.com.au/>
www.coherentsoftware.com.au
Coherent Software Australia Making your business more productive. Coherent Software specialise in custom software for small and medium businesses.



Email: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Problem with description field

Jeremy Olmstead
In reply to this post by SkipDever
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Problem with description field

SkipDever
In reply to this post by Paul Foxworthy
Thanks for the reply Paul.  Datatype is Varying 255.  Also, this field name (description) is used in dozens (hundreds?) of other entities like OrderAdjustment, OrderType, OrderTerm, Quote, Requirement, ReturnItem, etc, etc.  I don't have problems with any other entity, only this single one and the system has been in use for years (almost a decade now).

This is a production database, so Derby is out of the question.

Thanks in advance for thinking about it.

Skip

-----Original Message-----
From: Paul Foxworthy [mailto:[hidden email]]
Sent: Tuesday, May 09, 2017 6:58 PM
To: [hidden email]
Subject: Re: Problem with description field


Hi Skip,

Try it with Derby instead of Postgres. Postgres handles large text
differently from other databases, arguably better. Maybe OFBiz isn't doing
the right thing for Postgres. What's the Postgres data type for the
description columns?

Cheers

Paul Foxworthy


On 10 May 2017 at 10:33, Skip <[hidden email]> 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
>
>


--
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192
Australia

Phone: +61 3 9585 6788
Web: http://www.coherentsoftware.com.au/
Email: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Problem with description field

SkipDever
In reply to this post by Arun Sankar
Arun

Thanks for the response.  I am using postgres 9.1 for development and 9.2 in
production.  Once again, none of the other entities that use a description
field have this problem.  Only this single one.  pgAdmin reports the
description field for ReturnItem as character varying(255).  It reports the
description field for VendingMachinePack (the one I am having problems with)
as character varying(255) as well.

Note that I can edit the VendingMachinePack record created with Webtools and
successfully change the description field and have it stick.  The bit of
java code that creates the record is in a service with no "use-transaction"
statement, so the service is wrapped in a transaction.   Also note that ALL
the other fields in the entity (19 total) get updated correctly.  It is only
this single "description" field that is a problem.  As I said earlier, I
added a "descAgain" field (that duplicates the description field type) and
filled it with the same contents as the description field and it gets saved
to the database correctly, eg:

> input.put("description", description);
> input.put("descAgain", description);

"descAgain" gets written correctly, but "description" ends up blank.  A
strange problem.

Skip



-----Original Message-----
From: Arun Sankar [mailto:[hidden email]]
Sent: Wednesday, May 10, 2017 6:11 AM
To: [hidden email]
Subject: Re: Problem with description field



Hi Skip,


Can you share the version of Postgres which you are using. I am using
Postgres in my current project and have not experienced such an issue.


We use <field name="description" type="description"></field> on multiple
entities in ofbiz such as Product, InvoiceItem, Facility etc in Ofbiz.


Also I would suggest to create an Invoice and check the Description field on
the Invoice item. This would help to further understand whether this really
is an issue with using the name description.


Regards,

Arun Sankar

________________________________
From: Paul Foxworthy <[hidden email]>
Sent: Wednesday, May 10, 2017 7:28:17 AM
To: [hidden email]
Subject: Re: Problem with description field

Hi Skip,

Try it with Derby instead of Postgres. Postgres handles large text
differently from other databases, arguably better. Maybe OFBiz isn't doing
the right thing for Postgres. What's the Postgres data type for the
description columns?

Cheers

Paul Foxworthy


On 10 May 2017 at 10:33, Skip <[hidden email]> 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
>
>


--
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192
Australia

Phone: +61 3 9585 6788
Web: http://www.coherentsoftware.com.au/
Coherent Software - Custom software,web application and
...<http://www.coherentsoftware.com.au/>
www.coherentsoftware.com.au
Coherent Software Australia Making your business more productive. Coherent
Software specialise in custom software for small and medium businesses.



Email: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Problem with description field

SkipDever
In reply to this post by Jeremy Olmstead
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:[hidden email]]
Sent: Wednesday, May 10, 2017 11:00 AM
To: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: Problem with description field

taher
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 <[hidden email]> 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:[hidden email]]
> Sent: Wednesday, May 10, 2017 11:00 AM
> To: [hidden email]
> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Problem with description field

SkipDever
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:[hidden email]]
Sent: Thursday, May 11, 2017 3:05 AM
To: [hidden email]
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 <[hidden email]> 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:[hidden email]]
> Sent: Wednesday, May 10, 2017 11:00 AM
> To: [hidden email]
> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Problem with description field

SkipDever
In reply to this post by taher
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:[hidden email]]
Sent: Thursday, May 11, 2017 3:05 AM
To: [hidden email]
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 <[hidden email]> 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:[hidden email]]
> Sent: Wednesday, May 10, 2017 11:00 AM
> To: [hidden email]
> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: Problem with description field

Arun Sankar
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 <[hidden email]>
Sent: Friday, May 12, 2017 12:55:01 AM
To: [hidden email]
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:[hidden email]]
Sent: Thursday, May 11, 2017 3:05 AM
To: [hidden email]
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 <[hidden email]> 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:[hidden email]]
> Sent: Wednesday, May 10, 2017 11:00 AM
> To: [hidden email]
> 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: Problem with description field

taher
In reply to this post by SkipDever
Hi Skip,

Is there anything preventing you from copying the live environment to a
test directory to try and isolate the issue? Given your case is very
specific, it needs very focused debugging to isolate all other causes. It
could be the database, it could be the entity engine, it could something in
cache, or could be a genuine bug. My suspicion is around the exact word
"description" in the name, but I cannot confirm without further digging.

So you need to isolate to have a chance of figuring out what's wrong. The
information we have from you is minimal and I think not enough to trace
down the cause. Heck I'm not even sure what version of OFBiz are you on,
and what kind of tweaks did you do to the system.

Cheers,

Taher Alkhateeb

On Thu, May 11, 2017 at 10:25 PM, Skip <[hidden email]> wrote:

> 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:[hidden email]]
> Sent: Thursday, May 11, 2017 3:05 AM
> To: [hidden email]
> 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 <[hidden email]> 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:[hidden email]]
> > Sent: Wednesday, May 10, 2017 11:00 AM
> > To: [hidden email]
> > 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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Problem with description field

SkipDever
In reply to this post by Arun Sankar
Arun

Thanks so much for the suggestion.  This pointed me to the problem.  Turns
out that it was a stupid mistake on my part.  The mistake was a second
delegator.makeValue() that was supposed to be on an entity to store labels.
But instead of the the actual file, I mistakenly used the name of a view
that included both the print file VMPacksToPrint and VendingMachinePack.
The result was an INSERT (with the fields correct) on VendingMachinePack,
followed by an UPDATE on VendingMachinePack with the description field null
(because it was not included in the view).

The upside is that I discovered that it is possible to create/modify views
which I had previously thought were only read-only.  However,
GenericDAO.java is really clever in handling views.

Thanks again
Skip



-----Original Message-----
From: Arun Sankar [mailto:[hidden email]]
Sent: Friday, May 12, 2017 12:32 AM
To: [hidden email]
Subject: Re: Problem with description field


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 <[hidden email]>
Sent: Friday, May 12, 2017 12:55:01 AM
To: [hidden email]
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:[hidden email]]
Sent: Thursday, May 11, 2017 3:05 AM
To: [hidden email]
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 <[hidden email]> 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:[hidden email]]
> Sent: Wednesday, May 10, 2017 11:00 AM
> To: [hidden email]
> 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 <[hidden email]> 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
> >
> >
>
>