NPE while running diff against a table where primary key has PK_SEQ=2
Description
I am trying to run diffChangeLog against a database that has a table that looks like this:
This table has been created by hibernate 4.x and is a "connector" table used to implement a many-to-many relation between two models.
Runninng liquibase against this database ends with the following exception:
it crashes in Index.java, but interersting stuff actually happens in PrimaryKeySnapshotGenerator.snapshotObject() when it reads the schema and gets the following:
as you can see, there is only one key and its KEY_SEQ=2. When it makes the call
it has position=2, so it inserts the column as an item with index 1 into the list. It never has a chance to insert an item with index 0 to this list, which means it ends up with the list that has a "hole". Subsequent call to exampleIndex.setColumns(returnKey.getColumns()); causes NPE because of that.
Environment
Database server: MySQL 5.7.18 on Ubuntu 16.04.1 LTS and CentOS 6 jdbc driver: mariadb-java-client-1.1.1
I am trying to run diffChangeLog against a database that has a table that looks like this:
This table has been created by hibernate 4.x and is a "connector" table used to implement a many-to-many relation between two models.
Runninng liquibase against this database ends with the following exception:
it crashes in Index.java, but interersting stuff actually happens in
PrimaryKeySnapshotGenerator.snapshotObject() when it reads the schema and gets the following:
as you can see, there is only one key and its KEY_SEQ=2. When it makes the call
it has position=2, so it inserts the column as an item with index 1 into the list. It never has a chance to insert an item with index 0 to this list, which means it ends up with the list that has a "hole". Subsequent call to exampleIndex.setColumns(returnKey.getColumns()); causes NPE because of that.