У меня есть приложение springboot, настроенное с использованием конфигурации yaml. Когда он настроен для PgSql, он работает, но когда я пытаюсь настроить его для Oracle и запускаю приложения, я получаю следующую ошибку:
liquibase.exception.DatabaseException: Token SQL92 non supportato nella posizione: 417 [Failed SQL:
CREATE TABLE MVOLPINI.desk_user (
id NUMBER(38, 0) GENERATED BY DEFAULT AS IDENTITY NOT NULL,
login VARCHAR2(50) NOT NULL,
password_hash VARCHAR2(60),
first_name VARCHAR2(50),
last_name VARCHAR2(50),
email VARCHAR2(100),
image_url VARCHAR2(256),
activated NUMBER(1) NOT NULL,
activation_key VARCHAR2(20),
reset_key VARCHAR2(20),
reset_date TIMESTAMP, created_by VARCHAR2(50) NOT NULL,
created_date TIMESTAMP DEFAULT ${now} NOT NULL,
last_modified_by VARCHAR2(50), last_modified_date TIMESTAMP,
tenant_id NUMBER(38, 0),
CONSTRAINT PK_DESK_USER PRIMARY KEY (id),
UNIQUE (login),
UNIQUE (email))
]
Похоже, что hibernate пытается передать неправильное значение по умолчанию ({сейчас}), когда дело доходит до создания даты создания столбца. Это сущность:
@MappedSuperclass
@Audited
@EntityListeners(AuditingEntityListener.class)
public abstract class AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@CreatedBy
@Column(name = "created_by", nullable = false, length = 50, updatable =false)
@JsonIgnore
private String createdBy;
@CreatedDate
@Column(name = "created_date", nullable = false, updatable=false)
@JsonIgnore
private Instant createdDate = Instant.now();
@LastModifiedBy
@Column(name = "last_modified_by", length = 50)
@JsonIgnore
private String lastModifiedBy;
@LastModifiedDate
@Column(name = "last_modified_date")
@JsonIgnore
private Instant lastModifiedDate = Instant.now();
Я не смог найти в коде токен {сейчас}, который вызывает проблему.
Думая, что это генерируется аннотацией @CreatedDate, я попытался заменить ее другими аннотациями, такими как @Temporal и изменяя тип Instant с помощью Date, но я получил ту же ошибку. Кто-нибудь может мне помочь?
Это конфигурация yaml:
logging:
level:
ROOT: INFO
it.dedagroup.todo: INFO
io.github.jhipster: INFO
spring:
devtools:
restart:
enabled: false
livereload:
enabled: false
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:oracle:thin:@172.17.34.20:1521:db12Test
username: mvolpini
password: password1
driver-class-name: oracle.jdbc.driver.OracleDriver
jpa:
database-platform: org.hibernate.dialect.Oracle12cDialect
database: ORACLE
show-sql: false
properties:
hibernate.id.new_generator_mappings: true
hibernate.cache.use_second_level_cache: false
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: false
mail:
host: localhost
port: 25
username:
password:
thymeleaf:
cache: true
liquibase:
contexts: prodOracle
# ===================================================================
# To enable SSL, generate a certificate using:
# keytool -genkey -alias DeskBackend -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650
#
# You can also use Let's Encrypt:
# https://maximilian-boehm.com/hp2121/Create-a-Java-Keystore-JKS-from-Let-s-Encrypt-Certificates.htm
#
# Then, modify the server.ssl properties so your "server" configuration looks like:
#
# server:
# port: 8443
# ssl:
# key-store: keystore.p12
# key-store-password: <your-password>
# keyStoreType: PKCS12
# keyAlias: DeskBackend
# ===================================================================
server:
port: 8180
compression:
enabled: true
mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json
min-response-size: 1024
# ===================================================================
# JHipster specific properties
#
# Full reference is available at: http://www.jhipster.tech/common-application-properties/
# ===================================================================
jhipster:
http:
version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration)
cache: # Cache configuration
ehcache: # Ehcache configuration
time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
max-entries: 1000 # Number of objects in each cache entry
# CORS is only enabled by default with the "dev" profile, so BrowserSync can access the API
cors:
allowed-origins: "*"
allowed-methods: "*"
allowed-headers: "*"
exposed-headers: "Authorization"
allow-credentials: true
max-age: 1800
security:
authentication:
jwt:
secret: d593dbdfe07821e0f92f45cdef8bdccba69757ff
# Token is valid 24 hours
#token-validity-in-seconds: 86400
#token-validity-in-seconds-for-remember-me: 2592000
# Token is valid 1 year
token-validity-in-seconds: 946080000
token-validity-in-seconds-for-remember-me: 946080000
mail: # specific JHipster mail property, for standard properties see MailProperties
from: oracle@localhost
base-url: http://127.0.0.1:8080
metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
jmx.enabled: true
graphite: # Use the "graphite" Maven profile to have the Graphite dependencies
enabled: false
host: localhost
port: 2003
prefix: DeskBackend
prometheus: # Use the "prometheus" Maven profile to have the Prometheus dependencies
enabled: false
endpoint: /prometheusMetrics
logs: # Reports Dropwizard metrics in the logs
enabled: false
report-frequency: 60 # in seconds
logging:
logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
enabled: false
host: localhost
port: 5000
queue-size: 512
# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
# to have type-safe configuration, like in the JHipsterProperties above
#
# More documentation is available at:
# http://www.jhipster.tech/common-application-properties/
# ===================================================================
application:
И это конфигурация, относящаяся к жидкости:
@Bean
public SpringLiquibase liquibase(@Qualifier("taskExecutor") TaskExecutor taskExecutor,
DataSource dataSource, LiquibaseProperties liquibaseProperties) {
// Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start asynchronously
SpringLiquibase liquibase = new AsyncSpringLiquibase(taskExecutor, env);
liquibase.setDataSource(dataSource);
liquibase.setChangeLog("classpath:config/liquibase/master.xml");
liquibase.setContexts(liquibaseProperties.getContexts());
liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema());
liquibase.setDropFirst(liquibaseProperties.isDropFirst());
if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE)) {
liquibase.setShouldRun(false);
} else {
liquibase.setShouldRun(liquibaseProperties.isEnabled());
log.debug("Configuring Liquibase");
}
return liquibase;
}