New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when inserting prior-existing ConcreteNode #8

Closed
C7C8 opened this Issue Feb 7, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@C7C8
Contributor

C7C8 commented Feb 7, 2017

When a prior-existing ConcreteNode is inserted into the database using the DatabaseController.insertNode() function, the following error is generated:

Provider table already exists
Floor table already exists
Node table already exists
Office table already exists
Neighbor table already exists
org.apache.derby.shared.common.error.DerbySQLIntegrityConstraintViolationException: INSERT on table 'NODE' caused a violation of foreign key constraint 'SQL170206084352641' for key (3). The statement has been rolled back.

Caused by: ERROR 23503: INSERT on table 'NODE' caused a violation of foreign key constraint 'SQL170206084352641' for key (3). The statement has been rolled back.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
... [lots] more
org.apache.derby.shared.common.error.DerbySQLIntegrityConstraintViolationException: INSERT on table 'NODE' caused a violation of foreign key constraint 'SQL170206084352641' for key (3). The statement has been rolled back.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)

at integration.DatabasePathfindingTest.testLinkPersistance(DatabasePathfindingTest.java:49

Process finished with exit code 255

The code that generated the test may be found in src/test/java/integration/DatabasePathfindingTest.java:49. Maybe I'm just not databasing quite right? Hence the question tag.

@solashirai

This comment has been minimized.

Show comment
Hide comment
@solashirai

solashirai Feb 8, 2017

Contributor

The code inserting a default floor appears to have accidentally been removed or not properly pushed into here.
Pretty sure the cause of this error is that the node is trying to set it's floorID to 3 (hence error caused by key(3)) but the floor with ID 3 hasn't been inserted into the table.
I've added an insertfloor(3, "defaultfloor", 3) call in DatabaseController's static{}. This should make this error go away, unless testing is doing something where static{...} isn't being called.

This is a bandaid fix. works for now, TODO will be to properly handle this SQL exception

Contributor

solashirai commented Feb 8, 2017

The code inserting a default floor appears to have accidentally been removed or not properly pushed into here.
Pretty sure the cause of this error is that the node is trying to set it's floorID to 3 (hence error caused by key(3)) but the floor with ID 3 hasn't been inserted into the table.
I've added an insertfloor(3, "defaultfloor", 3) call in DatabaseController's static{}. This should make this error go away, unless testing is doing something where static{...} isn't being called.

This is a bandaid fix. works for now, TODO will be to properly handle this SQL exception

@C7C8 C7C8 closed this Feb 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment