Skip to content

COG-1151: W1 · Remaining 6 entities: GenerationType.AUTO → IDENTITY - #332

Open
patrickbradley-cog wants to merge 1 commit into
masterfrom
devin/cog-1151-w1-remaining-6-entities-generationtypeauto-identity
Open

patrickbradley-cog wants to merge 1 commit into
masterfrom
devin/cog-1151-w1-remaining-6-entities-generationtypeauto-identity

Conversation

@patrickbradley-cog

@patrickbradley-cog patrickbradley-cog commented Sep 30, 2026 •

Copy link
Copy Markdown

Summary

Linear: COG-1151 — W1 · Remaining 6 entities: GenerationType.AUTO → IDENTITY

W1 forward-compatible refactor on Boot 1.5.4 (no Boot/Java bump). This PR changes one annotation in each of the six entities below:

- @GeneratedValue(strategy = GenerationType.AUTO)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)

PrimaryAccount, SavingsAccount, PrimaryTransaction, SavingsTransaction, Recipient, Appointment. Nothing else changes: no namespace swap, no Lombok, no formatting churn. User.java and UserRole.java are left alone because other tickets own them.

Why: Boot 1.5.4 defaults to use-new-id-generator-mappings=false, so on MySQL AUTO already resolves to native AUTO_INCREMENT. Boot 2.0+ flips that default to true, and AUTO then becomes a hibernate_sequence table generator whose ids would collide with existing primary keys on first start. Setting IDENTITY explicitly does nothing on 1.5.4 and removes that risk before the pivot.

Merge order: merge this behind the W0 smoke suite (#106, #108, #109 / COG-1141) once that is green. It isn't on master yet, so I verified with the existing test plus a manual run against MySQL (below).

Verification

Environment: Temurin 8 (1.8.0), Maven, docker mysql:5.7.44. MySQL 8 won't work here because Boot 1.5.4's managed Connector/J 5.1.42 fails with Unknown system variable 'query_cache_size'. I pointed the app at the DB with SPRING_DATASOURCE_URL=jdbc:mysql://localhost:3306/onlinebanking?useSSL=false; Temurin 8u4xx disables TLSv1/1.1, which the old connector needs for SSL. That's an env override only and no repo config was changed.

1. mvn -B -f UserFront/pom.xml verify: BUILD SUCCESS on master and on this branch

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0   (UserFrontApplicationTests.contextLoads)
[INFO] Building jar: .../UserFront/target/userFront-0.0.1-SNAPSHOT.jar
[INFO] BUILD SUCCESS

2. Hibernate generates the same schema before and after (proves no change on 1.5.4)

  • Started from an empty DB, ran verify on origin/master (ddl-auto=update), and dumped SHOW CREATE TABLE for the 6 tables.
  • Dropped and recreated the DB, ran verify on this branch, and dumped again.
  • diff ddl-master.txt ddl-branch.txt → identical. Every id is bigint(20) NOT NULL AUTO_INCREMENT, and neither run creates a hibernate_sequence table.

3. Manual flow: inserts take the next AUTO_INCREMENT id
I seeded role, then moved each table's AUTO_INCREMENT to a distinct offset (primary_transaction=1000, savings_transaction=2000, appointment=3000, recipient=4000, primary_account=5000, savings_account=6000). Then I ran java -jar target/userFront-0.0.1-SNAPSHOT.jar and drove it with curl:

POST /signup                                    302 -> /
POST /index (login)                             302 -> /userFront
POST /account/deposit Primary 500               302 -> /userFront
POST /account/deposit Savings 300               302 -> /userFront
POST /account/withdraw Primary 50               302 -> /userFront
POST /transfer/betweenAccounts Primary->Savings 302 -> /userFront
POST /transfer/recipient/save                   302 -> /transfer/recipient
POST /appointment/create                        302 -> /userFront
GET  /account/primaryAccount                    200

Resulting rows. Every id is the seeded AUTO_INCREMENT value, which confirms Hibernate lets MySQL assign ids via IDENTITY:

primary_account      | 5000 | 11223146 | 425.00
savings_account      | 6000 | 11223147 | 325.00
primary_transaction  | 1000 | Deposit to Primary Account                       | 500 | 500.00
                     | 1001 | Withdraw from Primary Account                    |  50 | 450.00
                     | 1002 | Between account transfer from Primary to Savings |  25 | 425.00
savings_transaction  | 2000 | Deposit to savings Account                       | 300 | 300.00
recipient            | 4000 | Alice | 12345
appointment          | 3000 | 2026-10-15 10:30:00 | Chicago

Hibernate SQL shows insert into primary_transaction (amount, available_balance, date, ...) with no id column, so the database assigns it. The app log has no ERROR lines or exceptions.

The repo has no CI workflows. AdminPortal is untouched, so there's no Angular build.

Devin-Org: engineering

Link to Devin session: https://app.devin.ai/sessions/46d1b1c2d3af498db353c436f778ec05
Open in Devin Desktop: https://app.devin.ai/desktop/session/46d1b1c2d3af498db353c436f778ec05?variant=devin
Requested by: @patrickbradley-cog


Devin Review

Status Commit
⚪ Not started —

Run Devin Review

Devin Review (Staging)


Devin Review

Co-Authored-By: patrick.bradley <patrick.bradley@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant