hammett | Fast python test runner , compatible with a subset of pytest | Functional Testing library
kandi X-RAY | hammett Summary
kandi X-RAY | hammett Summary
Fast python test runner, compatible with a subset of pytest
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Main function
- Run tests
- Print arg to stdout
- Count all test results
- Calls catch_log
- Create a handler for logging
- Initialize the logger
- Runs dist
- Read the version number from the module
- Run git tag
- Get the version number
hammett Key Features
hammett Examples and Code Snippets
Community Discussions
Trending Discussions on hammett
QUESTION
Problem:
Autowiring SingerDaoImpl and JpaRepositoryImpl Bean results in a null result. No Exception is throw, but no Data is returned. Using Thymeleaf view to display data
Technologies Used:
Spring, JpaRepository, Hibernate, Thymeleaf, H2 Embedded DB (Script located in resources/SQL folder), Spring MVC, javax.validation.
I use localhost:8080/singers to list the singers through thymeleaf located in resources/templates/listSingers.html. Upon calling the /singers controller the number of singers retrieved is logged to the console through logger
Things I crossed out:
- No @Component(or its specializations) Class is declared with the new operator
- All beans that are @Autowired are Annotated with @Component, @Repository, or @Service
- Setters are already setup,
- @Qualifier is already pointing to the correct bean
- The Embedded Database IS populated with data as located in resources/SQL/test.sql and added through DBConfig.java class with the EmbeddedDatabaseBuilder.addScript("SQL/test.sql") method
- All dependencies in gradle.build file version is managed by gradle to be the latest version
Link to github page:
https://github.com/NikitaDyagilev/LearningSprinbMVC
note: I'm using Amazon Corretto Java 11
DBConfig.java
...ANSWER
Answered 2020-May-26 at 23:57You were almost there. In fact, your database was empty. Why? Because of this line in your DBConfig class.
prop.put("hibernate.hbm2ddl.auto", "create-drop");
(link to the documentation for this property). You can safely delete it or set the property to a value that makes sense for you.
You will also need to set the photo attribute (and the getters&setters for it) in your Singer class to Byte
(This kind of type is also called a Wrapper Class) instead of byte
since byte is a primitive value that cannot be set to null. In your DB script however, you allow photo to be null so, if you dont change this code, it will cause an exception when trying to map the DB columns into Java objects.Once youve down these two things, the list of singers will be shown in the browser.
Now, some final tips since you are somewhat new to programming and stackoverflow:
Read https://stackoverflow.com/help/how-to-ask carefully if you haven't already. It will help you write questions that people will want to answer and helps you avoid downvotes and being burried in stackoverflow.
I've checked out your repo and you're doing a lot of work and configuration that you do not have to do since you are using Spring Boot and Spring Boot Data Jpa and not simply Spring. I would encourage you to start using Spring Boot to its full extent first and then learn Spring and how to customize it to your needs, if you ever need solely Spring at all for your needs.Use this link as a gateway to learn more about Spring Boot and Spring Boot Data Jpa.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install hammett
You can use hammett like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page