(JPA)使用Filter的时候由于default_schema的原因导致Table not found

1. 比如有个实体类,里面定义了过滤器

@Entity
@Table(name = "RECORD")
@Filters({
        @Filter(name = "filter_1"),
        @Filter(name = "filter_2")
})
@FilterDefs({
        @FilterDef(name = "filter_1", defaultCondition = "field_1 is null"),
        @FilterDef(name = "filter_2", defaultCondition = "field_2 = :field_2",
                parameters = {@ParamDef(name = "field_2", type = "string")})
})
public class Record {
    ... ...
}

2. application.properties

spring.jpa.properties.hibernate.default_schema=TEST_DB

3. hibernate解析注解配置

拼接表名

会将default_schema和表名拼接起来,如:TEST_DB.RECORD

4. 执行过滤器的时候

图片说明
图片说明

过滤器中记录的表名与实体类配置中的表名匹配,然后,这里匹配不到就throw找不着表了。

截图都是hibernate源码。

怎么解决咧!!!

https://blog.csdn.net/zsy3313422/article/details/52594082