最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - After migrating to hibernate 6 and spring boot 3 createNativeQuery not work - Stack Overflow

programmeradmin2浏览0评论

I have method for search some object in postgre database:

private final EntityManager entityManager;

public Stream<Tuple> findTest1Set(Integer id,
                                               List<String> statuses,
                                               String filter,
                                               String type, 
                                               Integer id2) {
    return entityManager.unwrap(Session.class)
            .createNativeQuery(sql, Tuple.class)
            .setParameter("id", id)
            .setParameter("statuses", statuses)
            .getResultStream()
            
}

And some sql:

select
    *
from earp.as sys
where
    (sys.id = :id or sys.parent_id = :id)
  and (coalesce(statuses) is null
    or (sys.status not in (:statuses))
    )

And structure:

create table as
(
id integer default nextval('id_seq'::regclass) not null primary key,
status as_status_type not null
);

and:

create type as_status_type as enum ('CANCELLED', 'UNKNOWN');

And I get the error: ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ERROR: could not determine the data type of parameter $3

Who I can fix it? In hibernate 5 all was be ok I try other cast, but it's not work for my

发布评论

评论列表(0)

  1. 暂无评论