delete product

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

delete product

info@agentur-m3.de
Hi All,

I tried to create some test products (just product_id
and description and a user defined PRODUCT_TYPE_ID
"FLEAMARKETITEM")  using  a simple method.

ofbiz now gives me an error when deleting them.

Pressing delete-button the data engine says:

Delete failed (write error): org.ofbiz.entity.GenericEntityException:
org.ofbiz.entity.GenericDataSourceException: Exception while deleting
the following entity:
[GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
has been rolled back.)) (Exception while deleting the following entity:
[GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
has been rolled back.)))

Also I tried with SQL:

SQL Exception while executing the following:DELETE FROM PRODUCT WHERE
PRODUCT_TYPE_ID = 'FLEAMARKETITEM' (DELETE on table 'PRODUCT' caused a
violation of foreign key constraint 'PROD_KWD_PROD_NEW' for key
(fleamarket). The statement has been rolled back.)


So it seems I can't delete these items. What is going wrong?
How can I reset the entity state to correct relations?


Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: delete product

Michael Brohl-3
Hi,

there are foreign key constraints from other tables (I guess product
keywords). You first have to delete the product_keyword entities
relating to your product before you can delete your product.

Regards,

Michael

Am 30.01.15 um 09:16 schrieb [hidden email]:

> Hi All,
>
> I tried to create some test products (just product_id
> and description and a user defined PRODUCT_TYPE_ID
> "FLEAMARKETITEM")  using  a simple method.
>
> ofbiz now gives me an error when deleting them.
>
> Pressing delete-button the data engine says:
>
> Delete failed (write error): org.ofbiz.entity.GenericEntityException:
> org.ofbiz.entity.GenericDataSourceException: Exception while deleting
> the following entity:
> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
> has been rolled back.)) (Exception while deleting the following entity:
> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
> has been rolled back.)))
>
> Also I tried with SQL:
>
> SQL Exception while executing the following:DELETE FROM PRODUCT WHERE
> PRODUCT_TYPE_ID = 'FLEAMARKETITEM' (DELETE on table 'PRODUCT' caused a
> violation of foreign key constraint 'PROD_KWD_PROD_NEW' for key
> (fleamarket). The statement has been rolled back.)
>
>
> So it seems I can't delete these items. What is going wrong?
> How can I reset the entity state to correct relations?
>
>
> Thank you!


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: delete product

dhiraj.g
In reply to this post by info@agentur-m3.de
Hi

This error caused a violation of foreign key.
First you create the service for delete the record from  product_keyword entity,then this service will use under the service which delete the product.




Thanks
Dhiraj Gupta
ERP consultent
9990220686

Dhiraj Gupta
Reply | Threaded
Open this post in threaded view
|

Re: delete product

dhiraj.g
In reply to this post by info@agentur-m3.de
Hi

This error caused a violation of foreign key.
First you create the service for delete the record from  product_keyword entity,then this service will use under the service which delete the product.




Thanks
Dhiraj Gupta
ERP consultent
9990220686

Dhiraj Gupta
Reply | Threaded
Open this post in threaded view
|

Re: delete product

Pierre Smits
In reply to this post by info@agentur-m3.de
This is intended behaviour. Functionality to delete products is not
available in the applications as a result of the productId being a fk in
many dependencies.

Products can be set to be expired, in order to hide visibility.

Best regards,

Pierre Smits

*ORRTIZ.COM <http://www.orrtiz.com>*
Services & Solutions for Cloud-
Based Manufacturing, Professional
Services and Retail & Trade
http://www.orrtiz.com

On Fri, Jan 30, 2015 at 9:16 AM, [hidden email] <[hidden email]>
wrote:

> Hi All,
>
> I tried to create some test products (just product_id
> and description and a user defined PRODUCT_TYPE_ID
> "FLEAMARKETITEM")  using  a simple method.
>
> ofbiz now gives me an error when deleting them.
>
> Pressing delete-button the data engine says:
>
> Delete failed (write error): org.ofbiz.entity.GenericEntityException:
> org.ofbiz.entity.GenericDataSourceException: Exception while deleting
> the following entity:
> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
> has been rolled back.)) (Exception while deleting the following entity:
> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
> has been rolled back.)))
>
> Also I tried with SQL:
>
> SQL Exception while executing the following:DELETE FROM PRODUCT WHERE
> PRODUCT_TYPE_ID = 'FLEAMARKETITEM' (DELETE on table 'PRODUCT' caused a
> violation of foreign key constraint 'PROD_KWD_PROD_NEW' for key
> (fleamarket). The statement has been rolled back.)
>
>
> So it seems I can't delete these items. What is going wrong?
> How can I reset the entity state to correct relations?
>
>
> Thank you!
>
Reply | Threaded
Open this post in threaded view
|

Re: delete product

Ruth Hoffman-4
In reply to this post by info@agentur-m3.de
Hello All:
If you are at all curious where these keywords are coming from and why
there is this foreign-key dependency in the first place, then read on:

These database records are being created automatically because there are
Entity-Control-Actions (ECAs) placed directly on several of the Entities
that model the database table(s) used to create and manage products.

ECAs allow you to trigger one or more actions (automatically - no human
intervention) based on specified database manipulation(s) for configured
target Entities. For example, indexing keywords that are found in a
product description.

More to your situation: If you want to minimize the number of keywords
created for a product and thus minimize the number of database records
you must delete before you can remove the product record, then take a
look at the Catalog Manager -> Products -> Keywords -> Delete All Keywords.

Finally, IMHO there should be a way to delete a product from the
database. There are business situations where deleting a product is
valid and expiring a product is not. Unfortunately, the OFBiz Entity
Engine does not support cascading deletes.

Best Regards,
Ruth Hoffman
http://www.aesolves.com
[hidden email]

On 1/30/15 3:16 AM, [hidden email] wrote:

> Hi All,
>
> I tried to create some test products (just product_id
> and description and a user defined PRODUCT_TYPE_ID
> "FLEAMARKETITEM")  using  a simple method.
>
> ofbiz now gives me an error when deleting them.
>
> Pressing delete-button the data engine says:
>
> Delete failed (write error): org.ofbiz.entity.GenericEntityException:
> org.ofbiz.entity.GenericDataSourceException: Exception while deleting
> the following entity:
> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
> has been rolled back.)) (Exception while deleting the following entity:
> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
> has been rolled back.)))
>
> Also I tried with SQL:
>
> SQL Exception while executing the following:DELETE FROM PRODUCT WHERE
> PRODUCT_TYPE_ID = 'FLEAMARKETITEM' (DELETE on table 'PRODUCT' caused a
> violation of foreign key constraint 'PROD_KWD_PROD_NEW' for key
> (fleamarket). The statement has been rolled back.)
>
>
> So it seems I can't delete these items. What is going wrong?
> How can I reset the entity state to correct relations?
>
>
> Thank you!

Reply | Threaded
Open this post in threaded view
|

Re: delete product

Ruth Hoffman-4
Hello All:
For those who don't know this, I forgot to mention that there isn't a
way to simply "expire" a product as suggested by "Pierre".

Once the product is installed in the database - it is there to be seen
by whoever is smart enough to find it. That doesn't mean you can't find
ways to make it difficult to find. It means that if you know what you
are doing, you can find the product.

Best Regards
Ruth Hoffman
http://www.aesolves.com
[hidden email]
On 1/30/15 11:18 AM, Ruth Hoffman wrote:

> Hello All:
> If you are at all curious where these keywords are coming from and why
> there is this foreign-key dependency in the first place, then read on:
>
> These database records are being created automatically because there
> are Entity-Control-Actions (ECAs) placed directly on several of the
> Entities that model the database table(s) used to create and manage
> products.
>
> ECAs allow you to trigger one or more actions (automatically - no
> human intervention) based on specified database manipulation(s) for
> configured target Entities. For example, indexing keywords that are
> found in a product description.
>
> More to your situation: If you want to minimize the number of keywords
> created for a product and thus minimize the number of database records
> you must delete before you can remove the product record, then take a
> look at the Catalog Manager -> Products -> Keywords -> Delete All
> Keywords.
>
> Finally, IMHO there should be a way to delete a product from the
> database. There are business situations where deleting a product is
> valid and expiring a product is not. Unfortunately, the OFBiz Entity
> Engine does not support cascading deletes.
>
> Best Regards,
> Ruth Hoffman
> http://www.aesolves.com
> [hidden email]
>
> On 1/30/15 3:16 AM, [hidden email] wrote:
>> Hi All,
>>
>> I tried to create some test products (just product_id
>> and description and a user defined PRODUCT_TYPE_ID
>> "FLEAMARKETITEM")  using  a simple method.
>>
>> ofbiz now gives me an error when deleting them.
>>
>> Pressing delete-button the data engine says:
>>
>> Delete failed (write error): org.ofbiz.entity.GenericEntityException:
>> org.ofbiz.entity.GenericDataSourceException: Exception while deleting
>> the following entity:
>> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
>> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
>> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
>> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
>> has been rolled back.)) (Exception while deleting the following entity:
>> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
>> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
>> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
>> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
>> has been rolled back.)))
>>
>> Also I tried with SQL:
>>
>> SQL Exception while executing the following:DELETE FROM PRODUCT WHERE
>> PRODUCT_TYPE_ID = 'FLEAMARKETITEM' (DELETE on table 'PRODUCT' caused a
>> violation of foreign key constraint 'PROD_KWD_PROD_NEW' for key
>> (fleamarket). The statement has been rolled back.)
>>
>>
>> So it seems I can't delete these items. What is going wrong?
>> How can I reset the entity state to correct relations?
>>
>>
>> Thank you!
>

Reply | Threaded
Open this post in threaded view
|

Re: delete product

Ruth Hoffman-4
Sorry, I meant to type Pierre.
On 1/30/15 1:14 PM, Ruth Hoffman wrote:

> Hello All:
> For those who don't know this, I forgot to mention that there isn't a
> way to simply "expire" a product as suggested by "Pierre".
>
> Once the product is installed in the database - it is there to be seen
> by whoever is smart enough to find it. That doesn't mean you can't
> find ways to make it difficult to find. It means that if you know what
> you are doing, you can find the product.
>
> Best Regards
> Ruth Hoffman
> http://www.aesolves.com
> [hidden email]
> On 1/30/15 11:18 AM, Ruth Hoffman wrote:
>> Hello All:
>> If you are at all curious where these keywords are coming from and
>> why there is this foreign-key dependency in the first place, then
>> read on:
>>
>> These database records are being created automatically because there
>> are Entity-Control-Actions (ECAs) placed directly on several of the
>> Entities that model the database table(s) used to create and manage
>> products.
>>
>> ECAs allow you to trigger one or more actions (automatically - no
>> human intervention) based on specified database manipulation(s) for
>> configured target Entities. For example, indexing keywords that are
>> found in a product description.
>>
>> More to your situation: If you want to minimize the number of
>> keywords created for a product and thus minimize the number of
>> database records you must delete before you can remove the product
>> record, then take a look at the Catalog Manager -> Products ->
>> Keywords -> Delete All Keywords.
>>
>> Finally, IMHO there should be a way to delete a product from the
>> database. There are business situations where deleting a product is
>> valid and expiring a product is not. Unfortunately, the OFBiz Entity
>> Engine does not support cascading deletes.
>>
>> Best Regards,
>> Ruth Hoffman
>> http://www.aesolves.com
>> [hidden email]
>>
>> On 1/30/15 3:16 AM, [hidden email] wrote:
>>> Hi All,
>>>
>>> I tried to create some test products (just product_id
>>> and description and a user defined PRODUCT_TYPE_ID
>>> "FLEAMARKETITEM")  using  a simple method.
>>>
>>> ofbiz now gives me an error when deleting them.
>>>
>>> Pressing delete-button the data engine says:
>>>
>>> Delete failed (write error): org.ofbiz.entity.GenericEntityException:
>>> org.ofbiz.entity.GenericDataSourceException: Exception while deleting
>>> the following entity:
>>> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
>>> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
>>> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
>>> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
>>> has been rolled back.)) (Exception while deleting the following entity:
>>> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
>>> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
>>> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
>>> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
>>> has been rolled back.)))
>>>
>>> Also I tried with SQL:
>>>
>>> SQL Exception while executing the following:DELETE FROM PRODUCT WHERE
>>> PRODUCT_TYPE_ID = 'FLEAMARKETITEM' (DELETE on table 'PRODUCT' caused a
>>> violation of foreign key constraint 'PROD_KWD_PROD_NEW' for key
>>> (fleamarket). The statement has been rolled back.)
>>>
>>>
>>> So it seems I can't delete these items. What is going wrong?
>>> How can I reset the entity state to correct relations?
>>>
>>>
>>> Thank you!
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: delete product

info@agentur-m3.de
In reply to this post by info@agentur-m3.de
Thanks for all your info and comments.

I tried Michaels approach

>> You first have to delete the product_keyword entities relating to
>>your product before you can delete your product.

and it solved the problem for me (I'm not sure
if there had been records automatically created in
other product related tables, but I did not find
remaining records for that product so far).

It was confusing to me, that there is a delete button and it
then shows and error to delete the record (now
I understand it is valid).

A look at the implementation

public static String updateGeneric(HttpServletRequest request,
HttpServletResponse response) {

...

if (updateMode.equals("DELETE")) {
        // Remove associated/dependent entries from other tables here
        // Delete actual main entity last, just in case database is set up to
do a cascading delete, caches won't get cleared
        try {
          delegator.removeByPrimaryKey(findByEntity.getPrimaryKey());
        } catch (GenericEntityException e) {
          String errMsg =
UtilProperties.getMessage(GenericWebEvent.err_resource,
"genericWebEvent.delete_failed", locale) + ": " + e.toString();
          Debug.logWarning(e, errMsg, module);
          request.setAttribute("_ERROR_MESSAGE_", errMsg);
          return "error";
        }

        return "success";
}

shows it does not consider relations, just tries to delete the entity
record itself. Maybe this would be best in most cases.

I also found the function GenericDelegator.removeRelated.

It is used e.g. in
ProductUtilityServices  function mergeVirtualWithSingleVariant

as an example.


















Reply | Threaded
Open this post in threaded view
|

Re: delete product

Pierre Smits
If you feel that functionality is missing, and adding such functionality
would improve the adoption of the Product you are free to create an
Improvement JIRA and work on getting it in.

Ruth is right, there are many ways to get to hidden products, because that
is what they are: hidden, but not gone.

Best regards,

Pierre Smits

*ORRTIZ.COM <http://www.orrtiz.com>*
Services & Solutions for Cloud-
Based Manufacturing, Professional
Services and Retail & Trade
http://www.orrtiz.com

On Sat, Jan 31, 2015 at 9:53 AM, [hidden email] <[hidden email]>
wrote:

> Thanks for all your info and comments.
>
> I tried Michaels approach
>
> >> You first have to delete the product_keyword entities relating to
> >>your product before you can delete your product.
>
> and it solved the problem for me (I'm not sure
> if there had been records automatically created in
> other product related tables, but I did not find
> remaining records for that product so far).
>
> It was confusing to me, that there is a delete button and it
> then shows and error to delete the record (now
> I understand it is valid).
>
> A look at the implementation
>
> public static String updateGeneric(HttpServletRequest request,
> HttpServletResponse response) {
>
> ...
>
> if (updateMode.equals("DELETE")) {
>         // Remove associated/dependent entries from other tables here
>         // Delete actual main entity last, just in case database is set up
> to
> do a cascading delete, caches won't get cleared
>         try {
>           delegator.removeByPrimaryKey(findByEntity.getPrimaryKey());
>         } catch (GenericEntityException e) {
>           String errMsg =
> UtilProperties.getMessage(GenericWebEvent.err_resource,
> "genericWebEvent.delete_failed", locale) + ": " + e.toString();
>           Debug.logWarning(e, errMsg, module);
>           request.setAttribute("_ERROR_MESSAGE_", errMsg);
>           return "error";
>         }
>
>         return "success";
> }
>
> shows it does not consider relations, just tries to delete the entity
> record itself. Maybe this would be best in most cases.
>
> I also found the function GenericDelegator.removeRelated.
>
> It is used e.g. in
> ProductUtilityServices  function mergeVirtualWithSingleVariant
>
> as an example.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: delete product

Jacques Le Roux
Administrator
I will add that it's not only a technical matter.

In this case there was only 1 related record to delete. But in case where a product has been ordered, shipped, invoiced, etc., it's not only harder to
remove the related record (cascade might help indeed) but can be also an issue if ever you later need to audit your bizness, hence your DB. This
should never be forgotten.

This said I agree that in some cases *(should be only pre-production)* it could be convenient to have *ON DELETE CASCADE*
I even created a page in the wiki about that few years ago
https://cwiki.apache.org/confluence/display/OFBENDUSER/How+to+delete+tuples+added+to+test+a+setup

We could create a Jira. This means to be implemented at the Entity Engine level, and IMO disabled by default by using a property.

Jacques


Le 31/01/2015 10:02, Pierre Smits a écrit :

> If you feel that functionality is missing, and adding such functionality
> would improve the adoption of the Product you are free to create an
> Improvement JIRA and work on getting it in.
>
> Ruth is right, there are many ways to get to hidden products, because that
> is what they are: hidden, but not gone.
>
> Best regards,
>
> Pierre Smits
>
> *ORRTIZ.COM <http://www.orrtiz.com>*
> Services & Solutions for Cloud-
> Based Manufacturing, Professional
> Services and Retail & Trade
> http://www.orrtiz.com
>
> On Sat, Jan 31, 2015 at 9:53 AM, [hidden email] <[hidden email]>
> wrote:
>
>> Thanks for all your info and comments.
>>
>> I tried Michaels approach
>>
>>>> You first have to delete the product_keyword entities relating to
>>>> your product before you can delete your product.
>> and it solved the problem for me (I'm not sure
>> if there had been records automatically created in
>> other product related tables, but I did not find
>> remaining records for that product so far).
>>
>> It was confusing to me, that there is a delete button and it
>> then shows and error to delete the record (now
>> I understand it is valid).
>>
>> A look at the implementation
>>
>> public static String updateGeneric(HttpServletRequest request,
>> HttpServletResponse response) {
>>
>> ...
>>
>> if (updateMode.equals("DELETE")) {
>>          // Remove associated/dependent entries from other tables here
>>          // Delete actual main entity last, just in case database is set up
>> to
>> do a cascading delete, caches won't get cleared
>>          try {
>>            delegator.removeByPrimaryKey(findByEntity.getPrimaryKey());
>>          } catch (GenericEntityException e) {
>>            String errMsg =
>> UtilProperties.getMessage(GenericWebEvent.err_resource,
>> "genericWebEvent.delete_failed", locale) + ": " + e.toString();
>>            Debug.logWarning(e, errMsg, module);
>>            request.setAttribute("_ERROR_MESSAGE_", errMsg);
>>            return "error";
>>          }
>>
>>          return "success";
>> }
>>
>> shows it does not consider relations, just tries to delete the entity
>> record itself. Maybe this would be best in most cases.
>>
>> I also found the function GenericDelegator.removeRelated.
>>
>> It is used e.g. in
>> ProductUtilityServices  function mergeVirtualWithSingleVariant
>>
>> as an example.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: delete product

anahita goljahani
In reply to this post by info@agentur-m3.de
Hi,

  just so you know, you may prevent the automatic creation of keywords by
setting "autoCreateKeywords" to "N" in Product entity.

Kind regards

Anahita

2015-01-30 9:16 GMT+01:00 [hidden email] <[hidden email]>:

> Hi All,
>
> I tried to create some test products (just product_id
> and description and a user defined PRODUCT_TYPE_ID
> "FLEAMARKETITEM")  using  a simple method.
>
> ofbiz now gives me an error when deleting them.
>
> Pressing delete-button the data engine says:
>
> Delete failed (write error): org.ofbiz.entity.GenericEntityException:
> org.ofbiz.entity.GenericDataSourceException: Exception while deleting
> the following entity:
> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
> has been rolled back.)) (Exception while deleting the following entity:
> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
> has been rolled back.)))
>
> Also I tried with SQL:
>
> SQL Exception while executing the following:DELETE FROM PRODUCT WHERE
> PRODUCT_TYPE_ID = 'FLEAMARKETITEM' (DELETE on table 'PRODUCT' caused a
> violation of foreign key constraint 'PROD_KWD_PROD_NEW' for key
> (fleamarket). The statement has been rolled back.)
>
>
> So it seems I can't delete these items. What is going wrong?
> How can I reset the entity state to correct relations?
>
>
> Thank you!
>
Reply | Threaded
Open this post in threaded view
|

Re: delete product

info@agentur-m3.de
Hi Anahita,

thanks, yes that is useful for me.
I try to work with product-configurations
as simple as possible!

Kind regards

Ralf


Am 01.02.2015 um 06:47 schrieb Anahita Goljahani:

> Hi,
>
>   just so you know, you may prevent the automatic creation of keywords by
> setting "autoCreateKeywords" to "N" in Product entity.
>
> Kind regards
>
> Anahita
>
> 2015-01-30 9:16 GMT+01:00 [hidden email] <[hidden email]>:
>
>> Hi All,
>>
>> I tried to create some test products (just product_id
>> and description and a user defined PRODUCT_TYPE_ID
>> "FLEAMARKETITEM")  using  a simple method.
>>
>> ofbiz now gives me an error when deleting them.
>>
>> Pressing delete-button the data engine says:
>>
>> Delete failed (write error): org.ofbiz.entity.GenericEntityException:
>> org.ofbiz.entity.GenericDataSourceException: Exception while deleting
>> the following entity:
>> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
>> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
>> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
>> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
>> has been rolled back.)) (Exception while deleting the following entity:
>> [GenericEntity:Product][productId,fleamarket(java.lang.String)] (SQL
>> Exception while executing the following:DELETE FROM OFBIZ.PRODUCT WHERE
>> PRODUCT_ID=? (DELETE on table 'PRODUCT' caused a violation of foreign
>> key constraint 'PROD_KWD_PROD_NEW' for key (fleamarket). The statement
>> has been rolled back.)))
>>
>> Also I tried with SQL:
>>
>> SQL Exception while executing the following:DELETE FROM PRODUCT WHERE
>> PRODUCT_TYPE_ID = 'FLEAMARKETITEM' (DELETE on table 'PRODUCT' caused a
>> violation of foreign key constraint 'PROD_KWD_PROD_NEW' for key
>> (fleamarket). The statement has been rolled back.)
>>
>>
>> So it seems I can't delete these items. What is going wrong?
>> How can I reset the entity state to correct relations?
>>
>>
>> Thank you!
>>
>