Add order-fulfillment module: Spring Modulith 2.1 boundary enforcement, events, generated docs
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
$ mvn -pl order-fulfillment -am test
|
||||
(captured before adding @Table(name = "orders") to com.ankurm.modulithdemo.order.internal.Order)
|
||||
|
||||
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "create table [*]order (id bigint generated by default as identity, quantity integer not null, sku varchar(255), status varchar(255), primary key (id))"; expected "identifier"; SQL statement:
|
||||
create table order (id bigint generated by default as identity, quantity integer not null, sku varchar(255), status varchar(255), primary key (id)) [42001-240]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:514) ~[h2-2.4.240.jar:2.4.240]
|
||||
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) ~[h2-2.4.240.jar:2.4.240]
|
||||
at org.h2.message.DbException.getSyntaxError(DbException.java:261) ~[h2-2.4.240.jar:2.4.240]
|
||||
at org.h2.command.Parser.readIdentifier(Parser.java:5568) ~[h2-2.4.240.jar:2.4.240]
|
||||
at org.h2.command.Parser.parseCreateTable(Parser.java:8908) ~[h2-2.4.240.jar:2.4.240]
|
||||
at org.h2.command.Parser.parseCreate(Parser.java:6483) ~[h2-2.4.240.jar:2.4.240]
|
||||
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.createTable(AbstractSchemaMigrator.java:305) ~[hibernate-core-7.4.5.Final.jar:7.4.5.Final]
|
||||
at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:80) ~[hibernate-core-7.4.5.Final.jar:7.4.5.Final]
|
||||
|
||||
Root cause: JPA defaults an entity's table name to its simple name. `Order` the Java class
|
||||
becomes `order` the table name, and ORDER is a reserved word in H2 (and in the SQL
|
||||
standard, and in Postgres, and in MySQL) because of the ORDER BY clause. Hibernate's
|
||||
schema-update path logs this as an error and carries on, which is worse than failing fast
|
||||
-- the table partially/never exists and every INSERT against it fails later with its own,
|
||||
less obvious error. Fixed with @Table(name = "orders") on the entity.
|
||||
Reference in New Issue
Block a user