Tuesday, February 16, 2016

1960194 - HANA: View refactoring failed due to error 'NullPointerException'

Symptom

When refactoring a view ( here we call it <primary veiw>, it could be an attribute view, analytic view, calculation view) on HANA studio, in the popup window, there's a prompt saying this view is used by another view ( here we call it <referential view> ). But this referential view has been deleted and can't be found in database.
Please see the screen shot below, view ANA_SALES_CUST_STATE_TESTREFACTOR has been deleted from HDB and can't be seen in Navigator anymore:

If you ignore the prompt and continue the refactoring, the following error information will popup:
Error occured during the refactoring of <view_name>java.lang.NullPointerException   
at com.sap.ndb.studio.modeler.job.type.copymodels.MoveModelsHandler.updateReferences(MoveModelsHandler.java)   
at com.sap.ndb.studio.modeler.job.type.copymodels.MoveModelsHandler.moveModels(MoveModelsHandler.java)   
at com.sap.ndb.studio.modeler.job.type.copymodels.RefactorModelsJob.moveModels(RefactorModelsJob.java)   
at com.sap.ndb.studio.modeler.job.type.copymodels.RefactorModelsJob.refactor(RefactorModelsJob.java)   
at com.sap.ndb.studio.modeler.job.type.copymodels.RefactorModelsJob.run(RefactorModelsJob.java)   
at org.eclipse.core.internal.jobs.Worker.run(Worker.java)


Environment
HANA database 1.0 all releases


Reproducing the Issue
On HANA Studio, find out your view, Right click it -> Refactor -> Move, in popup window, choose the target package that you would move to, then click "Next".


Cause
This problem is usually caused by one of the following reasons:
  1. When you deleted the referential view, something went wrong, so this object was not permanently deleted from HANA database, but only was marked for deletion and can't be shown in Navigator anymore.
  2. When you deleted the referencing relationship, something went wrong, so this relationship was not permanently deleted from HANA database and can't be shown in Modeler perspective.


Resolution
If you make sure that the referential view won't be used anymore, you need firstly check if the referential view or the referencing relationship is still existing in system views. You can use the following SQL statements for checking:
SELECT * FROM "_SYS_REPO"."INACTIVE_OBJECT" WHERE package_id = '<package name>' AND object_name = '<referential view>';
SELECT * FROM "_SYS_REPO"."INACTIVE_OBJECTCROSSREF" WHERE from_package_id = '<package name>' AND from_object_name = '<referential view>';
Delete the unwanted entries using SQL commands:
DELETE FROM "_SYS_REPO"."INACTIVE_OBJECT" WHERE package_id = '<package name>' AND object_name = '<referential view>';
DELETE FROM "_SYS_REPO"."INACTIVE_OBJECTCROSSREF" WHERE from_package_id = '<package name>' AND from_object_name = '<referential view>'; 
Then you can retry to refactor the primary view.


See Also


Keywords
refactoring view, refactoring failed, move, NullPointerException, MoveModelsHandler, updateReferences, moveModels, MoveModelsHandler.java, refactor, RefactorModelsJob.java, INACTIVE_OBJECTCROSSREF, INACTIVE_OBJECT



Header Data

Released On 29.01.2014 08:50:14
Release Status Released to Customer
Component HAN-STD-DEV-MOD SAP HANA Analytical Modeling
Other Components
HAN-DB SAP HANA Database
Priority Normal
Category How To
Database
HDB 1.0

No comments:

Post a Comment