-
Notifications
You must be signed in to change notification settings - Fork 3
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
Viite 3094 add scalike jdbc #1680
Conversation
jounijoh
commented
Sep 13, 2024
- Set up ScalikeJDBC configuration and database connection
- Refactored Road Name models into separate files
- Added new Roadway case class to be used in fi.vaylavirasto.viite package
- 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
…ylavirasto.viite.dao package
… getRoadNamesForRoadAddressBrowser method in RoadNameService.scala.
viite-backend/api/src/main/scala/fi/liikennevirasto/digiroad2/ViiteApi.scala
Show resolved
Hide resolved
viite-backend/base/src/main/scala/fi/vaylavirasto/viite/model/RoadName.scala
Outdated
Show resolved
Hide resolved
viite-backend/base/src/main/scala/fi/vaylavirasto/viite/model/Roadway.scala
Outdated
Show resolved
Hide resolved
viite-backend/database/src/main/scala/fi/vaylavirasto/viite/dao/RoadNameDAO.scala
Outdated
Show resolved
Hide resolved
viite-backend/database/src/main/scala/fi/vaylavirasto/viite/dao/RoadNameScalikeDAO.scala
Show resolved
Hide resolved
viite-backend/database/src/main/scala/fi/vaylavirasto/viite/dao/RoadNameScalikeDAO.scala
Show resolved
Hide resolved
...ckend/database/src/main/scala/fi/vaylavirasto/viite/postgis/PostGISDatabaseScalikeJDBC.scala
Outdated
Show resolved
Hide resolved
...ckend/database/src/main/scala/fi/vaylavirasto/viite/postgis/PostGISDatabaseScalikeJDBC.scala
Outdated
Show resolved
Hide resolved
… addrMRange changes) (#1683)
- 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.
…ction from hide()
…nto viite-3094_add_scalikeJDBC
…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
* 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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ä