Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viite 3094 add scalike jdbc #1680

Conversation

jounijoh
Copy link
Contributor

  1. Set up ScalikeJDBC configuration and database connection
  2. Refactored Road Name models into separate files
  3. Added new Roadway case class to be used in fi.vaylavirasto.viite package
  4. Implemented initial DAO methods for Road Name data access with ScalikeJDBC

- Add ScalikeJDBC dependencies to build.scala
- Configure database properties in env.properties
- Update ViiteProperties.scala with ScalikeJDBC configurations
- Create PostGISDatabase.scala for database initialization
… classes from DAO Object file to RoadName.scala model file

- Add new RoadName.scala model file for case classes
- Modified imports to use the new file structure
… getRoadNamesForRoadAddressBrowser method in RoadNameService.scala.
- Removed unnecessary database configurations from env file and ViiteProperties.scala
- These configurations are now handled in PostGISDatabaseScalikeJDBC.scala
…rowserWindow.js did not close properly with risen application error.
…essions more controlled.

- Added runUpdateToDbScalike to DbUtils for test cases
- Added commonTestData as a val to be used in those tests.
-Test "roadNameService.getRoadNamesInTX() When searching for a newly create road name by it's road name Then return the entry for said road name." now uses only name in the search as the title suggests
…be passed through the transaction methods

- With this setup the implicit session does not have to be passed in every method
… use cases as it needs too much refactoring of the tests
- SessionProvider provides a thread-local session for ScalikeJDBC to handle transactions.
- When SessionProvider is imported, the implicit session is used in queries without the need to pass it as a parameter
- All database operations now use SessionProvider for session
- Operations are simplified to let ScalikeJDBC handle the opening and closing of transactions.
- DB is initialized on when the object is first called instead of the transaction operation to simplify the code
- All methods use SessionProvider now
- Removed manual Exception handling to let ScalikeJDBC handle them
- Added runSelectSingle to be used with sequences
- Added remaining methods to RoadNameScalikeDAO
- They Are now used with the RoadNameService and it now uses only ScalikeJDBC
- Implemented ProjectLinkNameScalikeDAO and first method for it to be used in RoadNameService
- All tests related to RoadName use ScalikeJDBC now
- The tests are wrapped in runWithRollbackScalike transaction method which uses the SessionProvider
- Added related Queries and Sequences to be handled with ScalikeJDBC
- Renamed RoadWay class in Base module to not to be mixed with the one in Main module
- Implemented RoadwayScalikeDAO to have result set mapping and first methods, needed with the tests.
…adNamesInTx and vice versa in RoadNameService to represent their actual use
@jounijoh jounijoh marked this pull request as ready for review October 3, 2024 12:46
* Get all road names from ROAD_NAME table with road number and optional start and end dates
*
* @param startDate Optional start date for the road names
* @param endDate Optional end date for the road names
Copy link
Contributor

Choose a reason for hiding this comment

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

Heeetkone, voiko startDatekin olla null?!?
Eeeei kyl pitäis olla koskaan.
endDate varmaan on null, jos nimi on vielä voimassa.

Copy link
Contributor

Choose a reason for hiding this comment

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

Eiku siis. Otetaas takas. Kommenttieja tarttee säätää.
Jotain tähän tyyliin:

  • @param startDate Optional oldest date from where the road names are returned
  • @param endDate Optional latest date from where the road names are returned

Mut en oo tohonkaan tyytyväinen, mielellään vielä paremmin/selkeämmin 😅
Nyt noista kommenteista saa sellaisen käsityksen, että niillä rajataan tulokset just tasan noihin päiviin.

* Get all road names from ROAD_NAME table with road name and optional start and end dates
*
* @param startDate Optional start date for the road names
* @param endDate Optional end date for the road names
Copy link
Contributor

Choose a reason for hiding this comment

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

Ja tänne toi sama ku yllä

@jounijoh jounijoh closed this Oct 25, 2024
@jounijoh jounijoh deleted the viite-3094_add_scalikeJDBC branch October 25, 2024 12:46
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.

2 participants