Почему не может создать колонку в таблице?
Не создается колонка в таблице, а в ibexpert код выполняется.
Код:
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
@Entity
@Table(name = "COMMON_BASE_DOC")
public class CancelledCertificates{
public CancelledCertificates() {
}
@Id
@Column(name = "ID")
private Long id;
@Formula("(select lic.identity_card_number from LAWYER_IDENTITY_CARD lic," +
"common_base_doc, lawyer_doc l where lic.id = common_base_doc.id and common_base_doc.id = id and " +
"l.lawyer_id = common_base_doc.lawyer_id and " +
"not exists(select * from lawyers where l.lawyer_id = lawyers.id and lawyers.lawyer_status = 5)")
private String identity_card_number;
Лог:
020-03-16 09:30:28.950 WARN 3804 --- [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 335544569, SQLState: 42000
2020-03-16 09:30:28.951 ERROR 3804 --- [nio-8080-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper : GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 128
.
2020-03-16 09:30:29.012 ERROR 3804 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement; SQL [select cancelledc0_.ID as id1_0_, (select lic.identity_card_number from LAWYER_IDENTITY_CARD lic, common_base_doc, cancelledc0_.lawyer_doc cancelledc0_.l where lic.id = common_base_doc.id and common_base_doc.id = cancelledc0_.id and l.lawyer_id = common_base_doc.lawyer_id and not exists(select * from lawyers where l.lawyer_id = lawyers.id and lawyers.lawyer_status = 5) as formula1_ from COMMON_BASE_DOC cancelledc0_]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement] with root cause
org.firebirdsql.gds.GDSException: Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 128
.
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2103) ~[jaybird-jdk18-2.2.15.jar:2.2.15-JDK_1.8 (build: tag=v2.2.15 date=201904061030)]
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2053) ~[jaybird-jdk18-2.2.15.jar:2.2.15-JDK_1.8 (build: tag=v2.2.15 date=201904061030)]
at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscDsqlPrepare(AbstractJavaGDSImpl.java:1461) ~[jaybird-jdk18-2.2.15.jar:2.2.15-JDK_1.8 (build: tag=v2.2.15 date=201904061030)]