Giter Club home page Giter Club logo

full-stack-development-with-spring-boot-and-react's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

full-stack-development-with-spring-boot-and-react's Issues

identifier in Car entity

Using year as a column is going to throw error as it is getting identified as 'expected "identifier"'
Using a different column name for year avoids this problem.

Issue encountered when reading Chapter: 3- Creating the entity classes: step 10.
jdk version :17
spring-boot :3.0.1
H2 :2.1.214

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "create table car (id bigint not null, brand varchar(255), color varchar(255), model varchar(255), price integer not null, register_number varchar(255), [*]year integer not null, primary key (id))"; expected "identifier"; SQL statement:
create table car (id bigint not null, brand varchar(255), color varchar(255), model varchar(255), price integer not null, register_number varchar(255), year integer not null, primary key (id)) [42001-214]

`server.port` in application.properties seems to be ignored once `spring-boot-security-starter` has been added into the project.

This is probably NOT specific to the code in this project/book, but asking anyway just in case some other newbie stumbles on the same issue later on:

When starting with the project I got lot of problems with a lingering java-process that was still bound to port 8080 after I had terminated the application from Eclipse IDE. Thus, I changed server.port value in application.properties to 8081 and everything worked fine for long time.

Now that I got to Chapter 5 and added spring-boot-security-starter dependency into the project, the server.port property seems no longer have any effect: The server now is bound to port 8080. Is this a bug or a feature of the framework?

Member `year` in the Car class results in JDBC SQL error

The Car class contains member year, which causes the SQL statement that creates the table to be invalid:

023-01-03 23:56:17.932 DEBUG 81860 --- [  restartedMain] o.h.l.p.build.spi.LoadPlanTreePrinter    : LoadPlan(entity=com.packt.cardatabase.domain.Car)
    - Returns
       - EntityReturnImpl(entity=com.packt.cardatabase.domain.Car, querySpaceUid=<gen:0>, path=com.packt.cardatabase.domain.Car)
    - QuerySpaces
       - EntityQuerySpaceImpl(uid=<gen:0>, entity=com.packt.cardatabase.domain.Car)
          - SQL table alias mapping - car0_
          - alias suffix - 0_
          - suffixed key columns - {id1_0_0_}

2023-01-03 23:56:17.934 DEBUG 81860 --- [  restartedMain] o.h.loader.entity.plan.EntityLoader      : Static select for entity com.packt.cardatabase.domain.Car [NONE]: select car0_.id as id1_0_0_, car0_.brand as brand2_0_0_, car0_.color as color3_0_0_, car0_.model as model4_0_0_, car0_.price as price5_0_0_, car0_.register_number as register6_0_0_, car0_.year as year7_0_0_ from car car0_ where car0_.id=?
2023-01-03 23:56:17.963 DEBUG 81860 --- [  restartedMain] org.hibernate.SQL                        : drop table if exists car CASCADE 
Hibernate: drop table if exists car CASCADE 
2023-01-03 23:56:17.967 DEBUG 81860 --- [  restartedMain] org.hibernate.SQL                        : drop sequence if exists hibernate_sequence
Hibernate: drop sequence if exists hibernate_sequence
2023-01-03 23:56:17.969 DEBUG 81860 --- [  restartedMain] org.hibernate.SQL                        : create sequence hibernate_sequence start with 1 increment by 1
Hibernate: create sequence hibernate_sequence start with 1 increment by 1
2023-01-03 23:56:17.973 DEBUG 81860 --- [  restartedMain] org.hibernate.SQL                        : create table car (id bigint not null, brand varchar(255), color varchar(255), model varchar(255), price integer not null, register_number varchar(255), year integer not null, primary key (id))
Hibernate: create table car (id bigint not null, brand varchar(255), color varchar(255), model varchar(255), price integer not null, register_number varchar(255), year integer not null, primary key (id))
2023-01-03 23:56:17.978  WARN 81860 --- [  restartedMain] o.h.t.s.i.ExceptionHandlerLoggedImpl     : GenerationTarget encountered exception accepting command : Error executing DDL "create table car (id bigint not null, brand varchar(255), color varchar(255), model varchar(255), price integer not null, register_number varchar(255), year integer not null, primary key (id))" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table car (id bigint not null, brand varchar(255), color varchar(255), model varchar(255), price integer not null, register_number varchar(255), year integer not null, primary key (id))" via JDBC Statement
	at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.6.14.Final.jar:5.6.14.Final]
	...
	at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.7.7.jar:2.7.7]



Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "create table car (id bigint not null, brand varchar(255), color varchar(255), model varchar(255), price integer not null, register_number varchar(255), [*]year integer not null, primary key (id))"; expected "identifier"; SQL statement:



create table car (id bigint not null, brand varchar(255), color varchar(255), model varchar(255), price integer not null, register_number varchar(255), year integer not null, primary key (id)) [42001-214]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:502) ~[h2-2.1.214.jar:2.1.214]
	...
	... 39 common frames omitted

The asterisk in the error message pinpoints the problem: using reserved word year as field name.

Renaming the member or escaping the name (with @Column(name=...)) fixes the issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.