gpt4 book ai didi

java - 错误的 hibernate 列类型 : Found: undefined

转载 作者:太空宇宙 更新时间:2023-11-04 09:03:08 25 4
gpt4 key购买 nike

我在服务器(websphere)启动时遇到以下异常。 VIEW_LTABLE_FULL_CLEARANCE_DAY 是 Oracle 上的 View

Caused by: org.hibernate.HibernateException: Wrong column type in CALMS2CMS_SCHEMA_25.VIEW_LTABLE_FULL_CLEARANCE_DAY for column table_code. Found: undefined, expected: varchar2(255 char)
at org.hibernate.mapping.Table.validateColumns(Table.java:373)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1305)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:512)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1797)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
at org.springframework.orm.jpa.vendor.SpringHibernateEjbPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateEjbPersistenceProvider.java:51)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:384)
... 41 more

TABLE_CODE 列定义为:

TABLE_CODE  NOT NULL VARCHAR2(5 CHAR)

该列的 Hibernate 实体映射是:

@Column(name = "table_code")
private String tableCode;

查看定义:

CREATE OR REPLACE FORCE VIEW VIEW_LTABLE_FULL_CLEARANCE_DAY (
TABLE_TYPE,
TABLE_CODE,
TABLE_TERRITORY_CODE,
DESCRIPTION,
FULL_CLEARANCE_DAYS,
RECEIPT_REQUIRED
) AS
SELECT
TYPE AS TABLE_TYPE,
CODE AS TABLE_CODE,
TERRITORY_CODE AS TABLE_TERRITORY_CODE,
DESCRIPTION,
FULL_CLEARANCE_DAYS,
RECEIPT_REQUIRED
FROM PAYMENT

我不明白的是为什么错误显示Found: undefined

映射似乎是正确的。

最佳答案

尝试通过以下方式更正您的 tableCode 定义:

@Column(name = "table_code", columnDefinition = "VARCHAR2(5 CHAR)")
private String tableCode;

按照 this 中的建议文章。

关于java - 错误的 hibernate 列类型 : Found: undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60539366/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com