The identity keyword for PostgreSQL was hardcoded to SERIAL, which lead to gnarly inconsistencies like this:
class User {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.NATIVE)
private long id;
// ...
}
CREATE TABLE "USER"
(
"ID" SERIAL -- Wrong: SERIAL is equivalent to integer / int4. Java type is long, so this should be BIGSERIAL
-- ...
);
CREATE TABLE "USERS_PERMISSIONS"
(
"USER_ID" int8 NOT NULL -- Correct: int8 aliases bigint
-- ...
);
To solve this I needed additional context about the mapped column type in DatastoreAdapter#getIdentityKeyword. Added a new default method to the DatastoreAdapter interface, that just calls the original getIdentityKeyword(StoreManager) method if not overridden, ensuring that this change is backward compatible.
The identity keyword for PostgreSQL was hardcoded to
SERIAL
, which lead to gnarly inconsistencies like this:To solve this I needed additional context about the mapped column type in
DatastoreAdapter#getIdentityKeyword
. Added a new default method to theDatastoreAdapter
interface, that just calls the originalgetIdentityKeyword(StoreManager)
method if not overridden, ensuring that this change is backward compatible.Fixes #455
Signed-off-by: nscuro nscuro@protonmail.com