feat: Add Account POJO and AccountHandler with JDBC connection and query methods#80
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
feat: Add Account POJO and AccountHandler with JDBC connection and query methods#80devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
5 tasks
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Java equivalent of the existing COBOL
sql_example.cblprogram under a newsql/java/directory. This is the data-access foundation for the COBOL-to-Java migration of the PostgreSQL account querying program.Two new files:
Account.java— POJO mirroring the COBOLws-account-recordstructure (8 fields: id, firstName, lastName, phone, address, isEnabled, createDt, modDt). All-args constructor, getters,toString().AccountHandler.java— JDBC connection manager with query methods that mirror the three COBOL cursors (ACCOUNT-ALL-CUR,ACCOUNT-DISABLED-CUR,ACCOUNT-QUERY-CUR):connect()/disconnect()— lifecycle managementgetAllAccounts()— all rows ordered by IDgetDisabledAccounts()— filtered toIS_ENABLED = 'N'searchAccounts(String)— LIKE search across first name, last name, phone, addressdisplayAccounts(List<Account>)— tabular output matching the COBOLdisplay-account-resultsparagraph formatAll queries use
PreparedStatement. Error handling prints SQL state, error code, and message (matching the COBOLcheck-sql-statepattern). Connection failure callsSystem.exit(1)to mirror the COBOLstop runbehavior.Both files compile cleanly against JDK 11.
Review & Testing Checklist for Human
displayAccountscolumn widths match the COBOL output format (ID:5, First:8, Last:8, Phone:10, Address:22, Enabled:1). Compare theprintfformat strings against the COBOLdisplay-account-resultsparagraph (lines 400-430 ofsql_example.cbl).searchAccountsnull-safety — passingnullwould produce the LIKE pattern%null%(string concatenation). Decide if a null guard is needed or if this is acceptable for the migration scope.DB_URL,DB_USER,DB_PASSWORDare plaintext constants matching the COBOL connection string. Acceptable for this example/migration repo, but flag if the project intends to externalize config later.create_test_db.sql, compile both files with the PostgreSQL JDBC driver on the classpath, and write a shortmain()to callconnect()→getAllAccounts()→displayAccounts()→disconnect()to verify output matches the COBOL program.Notes
Main.javais included — that will be a separate ticket.createDt/modDtare stored asString(matching the COBOLPIC X(20)) rather thanjava.sql.Timestamp. This is intentional for COBOL parity but could be revisited.packagedeclaration), consistent with the simple example nature of this repo.Link to Devin session: https://app.devin.ai/sessions/0ebdc63cd333461ca6a0cce03146215a
Requested by: @Colhodm