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

I have method for search some object in postgre database:private final EntityManager entityManager;pub

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744510364a4577956.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信