Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0014914Openbravo ERPA. Platformpublic2010-10-19 13:122010-12-09 16:07
mirurita 
mtaal 
immediatemajoralways
closedfixed 
5
pi 
 
Core
No
0014914: Error related to views in DAL: cannot modify a column which maps to a non key-preserved table
When trying to process a Payment Proposal that has been paid partially it shows the following error
Oracle: ORA-01779: cannot modify a column which maps to a non key-preserved table
Caused by: java.sql.BatchUpdateException: ORA-01779: cannot modify a column which maps to a non key-preserved table
    at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:629)
    at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9409)
    at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:211)
    at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)


PostgreSQL: cannot insert into a view
0 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 0 insert into FIN_Payment_Prop_Detail_V (AD_Client_ID, AD_Org_ID, Isactive, Created, Createdby, Updated, Updatedby, FIN_Payment_Scheduledetail_ID, FIN_Payment_Proposal_ID, Invoiceno, Duedate, Invoicedamt, Expected, Paidamt, C_Bpartner_ID, Writeoffamt, FIN_Payment_Prop_Detail_V_ID) values (1000000, 1000000, Y, 2010-10-26 16:33:27.907000 +0200, 100, 2010-10-26 16:33:28.574000 +0200, 100, FF8080812BE8F4B1012BE8F540FD001B, FF8080812BE8F4B1012BE8F53DF40017, 200015, 2010-10-26 00:00:00.000000 +0200, 182.00, 182.00, 100, 1000008, 0, FF8080812BE8F4B1012BE8F540FE001C) was aborted. Call getNextException to see the cause.


It was working successfully before the support to views was included in core.
1) Install APRM 1.0.7 module and import the dataset.

2) Create a Payment Method in Financial Management || Receivables & Payables || Setup || Payment Method || Payment Method
With the following configuration
Allow Payment IN / OUT: Yes / Yes
Automatic receipt / deposit: No / No
Automatic payment / withdrawn: No / No
Execution type: Manual
Upon receipt / deposit: In transit
Upon deposit / withdrawn: Deposit / Withdrawn
Upon clearing use: Cleared account

3) Create a new Financial account in Financial Management || Receivables & Payables || Transactions || Financial Account || Account
3.1) Go to Payment Method tab and associate the previously created Payment Method.

4) Create and complete 2 Purchase invoices for different business partners and select the previously created payment method.

5) Go to Financial Management || Receivables & Payables || Transactions || Payment Proposal || Header and create a new one with the following info:
Payment Method: previously created payment method.
Financial account: previously created financial account;
Payment Date: today.

5) Press Select Expected Payments buttons and pay partially two payments. Enter less amount than expected in the editable textboxes of the grid. Click Process button.

6) Finally click on Generate Payments button and the error will appear.
No tags attached.
Issue History
2010-10-19 13:12miruritaNew Issue
2010-10-19 13:12miruritaAssigned To => mtaal
2010-10-25 08:55alostaleStatusnew => scheduled
2010-10-26 16:40miruritaNote Added: 0032229
2010-10-26 16:42miruritaDescription Updatedbug_revision_view_page.php?rev_id=1137#r1137
2010-10-28 13:21dmitry_mezentsevNote Added: 0032301
2010-10-28 13:21dmitry_mezentsevPriorityurgent => immediate
2010-10-28 15:37hgbotCheckin
2010-10-28 15:37hgbotNote Added: 0032308
2010-10-28 15:37hgbotStatusscheduled => resolved
2010-10-28 15:37hgbotResolutionopen => fixed
2010-10-28 15:37hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/3a1e20b709fef01342aee00e450346cb8b87f5f2 [^]
2010-10-28 16:38hgbotCheckin
2010-10-28 16:38hgbotNote Added: 0032312
2010-10-28 17:18shuehnerNote Added: 0032316
2010-11-05 12:44hudsonbotCheckin
2010-11-05 12:44hudsonbotNote Added: 0032438
2010-11-05 12:44hudsonbotCheckin
2010-11-05 12:44hudsonbotNote Added: 0032440
2010-11-25 20:14shuehnerNote Added: 0032870
2010-11-25 20:14shuehnerStatusresolved => closed
2010-12-09 16:07anonymoussf_bug_id0 => 3133520

Notes
(0032229)
mirurita   
2010-10-26 16:40   
I've created an JUnit test case to easily reproduce the issue. It does the steps described before.

Clone the repository [1] (it depends on the User Interface Selector) and launch the following ant task: "ant PaymentTest_05"

It is reproducible in Oracle and PostgreSQL.

[1]https://code.openbravo.com/erp/pmods/org.openbravo.advpaymentmngt/ [^]
(0032301)
dmitry_mezentsev   
2010-10-28 13:21   
This issue blocks MP23 release.
(0032308)
hgbot   
2010-10-28 15:37   
Repository: erp/devel/pi
Changeset: 3a1e20b709fef01342aee00e450346cb8b87f5f2
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Oct 28 15:36:33 2010 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/3a1e20b709fef01342aee00e450346cb8b87f5f2 [^]

Fixes issue 14914: Error related to views in DAL: cannot modify a column which maps to a non key-preserved table

---
M src/org/openbravo/dal/core/DalMappingGenerator.java
---
(0032312)
hgbot   
2010-10-28 16:38   
Repository: erp/devel/pi
Changeset: 0a0fb2432e0d82f840168b004e3381318179975f
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Oct 28 16:38:06 2010 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/0a0fb2432e0d82f840168b004e3381318179975f [^]

Related to issue 14914: Error related to views in DAL: cannot modify a column which maps to a non key-preserved table

---
M src-test/org/openbravo/test/dal/ViewTest.java
M src/org/openbravo/dal/core/DalUtil.java
---
(0032316)
shuehner   
2010-10-28 17:18   
First changeset (a1e20b709fef01342aee00e450346cb8b87f5f2) reviewed & tested. > working fine
(0032438)
hudsonbot   
2010-11-05 12:44   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/3a1e20b709fe [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/f2cf138fa03c [^]
Tests: http://builds.openbravo.com/view/int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.18797.obx [^]
(0032440)
hudsonbot   
2010-11-05 12:44   
A changeset related to this issue has been promoted to main after passing a series of tests and an OBX has been generated:

Changeset: http://code.openbravo.com/erp/devel/main/rev/0a0fb2432e0d [^]
Merge Changeset: http://code.openbravo.com/erp/devel/main/rev/f2cf138fa03c [^]
Tests: http://builds.openbravo.com/view/int/ [^]
OBX: http://builds.openbravo.com/erp/core/obx/OpenbravoERP-2.50CI.18797.obx [^]
(0032870)
shuehner   
2010-11-25 20:14   
Second part reviewed. Looks ok, and newly added junit testcase for it also succeeds.