You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BugFix: Allow non-primary-key generated fields, e.g. timestamps, counters, etc. (#96)
* Allow non-primary-key generated fields, e.g. timestamps, counters, etc.
Currently, HibernateD treats `@Generated` as being inseparable from `@Id`,
it is assumed that any generated field is also the primary key.
However, a database table can have non-primary-key columns that are `@Generated`.
For example, a database that keeps track of a timestamp, which is populated
via a DB trigger or a default value, e.g. `now()`, may exist alongside a
separate primary key.
In order to support this kind of data, the assumption that `@Generated` implies
`@Id` needs to be undone. This PR changes the core logic and also adds a basic
test around generated columns to validate schema generation as well as the ability
to insert and update such records.
* Not sure how that change go in there.
* The transaction test cleanup isn't complete apparently.
* For MySQL, add a UNIQUE constraint for non-PK generated columns.
* Fix syntax error in MySQL when setting UNIQUE.
* Add logic to add defaults for MySQL generated non-integer types.
* Make sure SqlType.BIGINT gets an autoincrement in MySQL.
* Make sure generated parameters can still be manually set.
* Update pgsqldialect to use a default value in schema generation when no generator exists for column type.
* In pgsqldialect, autoincrement becomes the type, not an attribute.
* Remove some debug output.
0 commit comments