in Education by
I am using spring-boot latest 2.1.3 release and want to start with testcases, but this is not working on my side. I have a simple entity @AllArgsConstructor @NoArgsConstructor @Data @Entity @Table(name = "foo.Account" ) public class UserEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "uid") private Long id; @Column(name= "login") private String username; @Column(name = "password_hash") private String password; } with this repository @Repository("UserRepository") public interface UserRepository extends JpaRepository { } Now I want to write a test for this repository @RunWith(SpringRunner.class) @DataJpaTest @EnableJpaRepositories @TestPropertySource(properties = { "spring.jpa.hibernate.ddl-auto=create-drop" }) public class UserRepositoryTest { @Autowired UserRepository repository; @Test public void insertTest(){ UserEntity ue = new UserEntity(); ue.setUsername("foo"); ue.setPassword("bar"); // ue.setRoles(new ArrayList<>()); repository.save(ue); } } In my test resources I have putted this schema.sql CREATE SCHEMA IF NOT EXISTS FOO But if fails because of a syntax error, I do not understand why this is happening. the hibernate_sequence table will be created because of the Annotation GenerationType.Auto 2019-03-22 14:36:38.421 ERROR 9552 --- [ main] o.hibernate.id.enhanced.TableStructure : could not read a hi value org.h2.jdbc.JdbcSQLException: Syntax Fehler in SQL Befehl "SELECT NEXT_VAL AS ID_VAL FROM foo.HIBERNATE_SEQUENCE WITH[*] (UPDLOCK, ROWLOCK) " Syntax error in SQL statement "SELECT NEXT_VAL AS ID_VAL FROM foo.HIBERNATE_SEQUENCE WITH[*] (UPDLOCK, ROWLOCK) "; SQL statement: select next_val as id_val from epls_dbo.hibernate_sequence with (updlock, rowlock) [42000-197] I know that you can discuss why to test this repository and it would be better to do integration tests, but I want to be able to make a testcase for a repository, hopefully someone can help. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Could you try using GenerationType.IDENTITY instead of GenerationType.AUTO in entity

Related questions

0 votes
    I am using spring-boot latest 2.1.3 release and want to start with testcases, but this is not ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I created a microservice project that consist of a few services. In one of these services, I added an ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I am using spring boot command line runner app, it hangs at PostGIS dialect, the below stack trace contains ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    Spring Boot is example of __________. A. Service Deployment B. Service registry C. Chassis Framework D. API Gateway...
asked Jan 11, 2023 in Technology by JackTerrance
0 votes
    Spring boot follows Opinionated Defaults Configuration approach to reduce developer effort. A. True B. False...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    For which of the following criteria can Spring boot auto configuration be done? A. Presence of a System Property B. ... of a particular class in classpath E. All the options...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    The embedded server that starts up with the Spring boot application is ____________. A. Tomcat server B. Weblogic server C. None of the options D. Server has to be configured...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    I'm new to Java and Spring boot and I am trying to read and Parse RSS feed from a site. What's the ... XmlReader(feedSource)); pageNumber = pageNumber + 1; } while ( pageNumber...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I am trying to make requests to dedicated WSDL server with the help of Apache Camel CXF. I have ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 5, 2022 in Education by JackTerrance
0 votes
    Which of the following enables production-ready features to the spring boot application? 1. Endpoint 2. Actuators 3. Boot 4. None of the above...
asked Jul 25, 2021 in Technology by JackTerrance
0 votes
    How can we override the default properties of Spring boot projects?...
asked Jul 23, 2021 in Technology by JackTerrance
0 votes
    What is the role of actuator in spring boot?...
asked Jul 23, 2021 in Technology by JackTerrance
0 votes
    Explain about the spring cloud and spring boot?...
asked Jul 23, 2021 in Technology by JackTerrance
0 votes
    Starting points of Spring Boot Application? 1. @Controller 2. @SpringBootApplication 3. @Service 4. None of the Above...
asked Jul 8, 2021 in Education by JackTerrance
0 votes
    Is Dependency needed to create a Spring Boot web application? 1. Spring-boot-starter-web 2. Spring-boot-starter-test 3. Spring-boot-html 4. None of the Above...
asked Jul 8, 2021 in Education by JackTerrance
...