I was trying to add new address hierarchy but I get this error message
I have the following installed
Bahmni ver. 0.91 mysqld ver. 5.6.43
Address Hierarchy ver. 2.11.0
I was trying to add new address hierarchy but I get this error message
I have the following installed
Bahmni ver. 0.91 mysqld ver. 5.6.43
Address Hierarchy ver. 2.11.0
Moved to the bahmni category.
@dkayiwa do you know anyone you can recommend to help me with this error. I’ve been stuck with it for 2 weeks now
How are you loading the address hierarchy?
I used a CSV file with just 2 columns, using pipe as the delimiter. I had checked the option to overwrite existing records. My address hierarchy template only has 2 fields.
But now I can’t even access the Address Hierarchy menu because of that error. So far I have tried stopping and starting the module, uninstalling and re-installing the module but the error still persists
Does the error still happen even after the module is uninstalled?
The link is removed from the Admin centre once I uninstall the module
If i just installed the bare OpenMRS and this module, would i be able to reproduce your problem? If yes, what are the exact steps?
I’m not too sure, the OpenMRS was installed with the Bahmni installer that I used
@dkayiwa @binduak I saw this in the logs
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.openmrs.module.addresshierarchy.AddressHierarchyEntry#1748]
So I logged into MYSQL and ran this statement
mysql> select * from address_hierarchy_entry;
From the output I noticed there is no record with address_hierarchy_entry_id
= 1748, see below screenshot
Additionally I noticed that my address hierarchy was not loaded properly, see area highlighted red. Is there a way I can flush these entries?
Update
I managed to resolve this by truncating the address_hierarchy_level
table and rebuilding the address hierarchy from scratch.
Hello @tapologo, i have succumbed to the same problem too, how did you manage to truncate the table despite on my side it outputs an error.
TRUNCATE TABLE * from address_hierarchy_level;
ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint (openmrs
.address_hierarchy_entry
, CONSTRAINT level_to_level
FOREIGN KEY (level_id
) REFERENCES openmrs
.address_hierarchy_level
(address_hierarchy_level_id
))
Any solution to this.
Thanks
@apuda are you able to delete individual records from the database or that also fails? Did your address hierarchy get uploaded in the DB but not in the correct format as it was the case with mine?
Thanks for your attention on this issue. @tapologo, i didnt try to delete individual records from the database instead i was trying to follow what worked for at the level of address_hierarchy_level
table by issuing the TRUNCATE COMMAND,
the address hierarcy did not fully get uploaded.
is there away i can as well rebuild this address_hierarchy_level
though the TRUNCATE command has failed due to FOREIGN KEY constraint.
Thanks
@apuda try deleting the the records you added either using timestamp or some other pattern. That should resolve the issue. For me the records which were added were the ones causing the issue
This i have tried and failed,is there a another way which ca yield me positive results than destroying the whole database? @dkayiwa any help here. Thanks
@apuda what is the exact problem that you are facing? Can you also share the server side log via pastebin.com?