Created
February 9, 2022 03:10
-
-
Save delphym/1a45d020efa3a1f8ca62acbc5d08fa71 to your computer and use it in GitHub Desktop.
To demonstrate how to run simple SELECT statement and get result back as a list of defined object models.
This file contains 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
@SpringBootTest | |
class DBquerryAsListTest { | |
@Autowired | |
@Qualifier("testSetupDataSource") | |
DataSource testSetupDataSource; | |
JdbcTemplate jdbcTemplate; | |
@Test | |
void runSelectQuerryTest() { | |
jdbcTemplate = new JdbcTemplate(testSetupDataSource); | |
List<TestDataResponseModel> dataResponses = jdbcTemplate.query("SELECT * FROM vw_subscriptions WHERE instanceId in (?, ?);", new LiteDBBeanPropertyRowMapper<>(TestDataResponseModel.class), instanceId, upgradeInstanceId); | |
assertTrue(dataResponses.size() > 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment