NonUniqueDiscoveredSqlAliasException: обнаружен дублированный псевдоним SQL - PullRequest
0 голосов
/ 20 сентября 2018

Я пытался протестировать несколько результатов конструктора.Я получил это сообщение об исключении: org.hibernate.loader.custom.NonUniqueDiscoveredSqlAliasException: Обнаружен дублированный псевдоним sql [ID] во время автоматического обнаружения запроса native-sql

Вот аннотация sqlresultsetmapping:

SqlResultSetMapping(name = RoomHktaskListWrapper.ROOMHKTASKLISTWRAPPER, classes = {
            @ConstructorResult(targetClass = RoomHktaskListWrapper.class, columns = {
                    @ColumnResult(name = "ID", type = Long.class),
                    @ColumnResult(name = "ROOMNO", type = String.class),
                    @ColumnResult(name = "ROOMTYPEID", type = Long.class),
                    @ColumnResult(name = "ROOMTYPE", type = String.class),
                    @ColumnResult(name = "ROOMTYPEDESC", type = String.class),
                    @ColumnResult(name = "TRANSDATE", type = LocalDate.class),
                    @ColumnResult(name = "FLOORID", type = Long.class),
                    @ColumnResult(name = "FLOORCODE", type = String.class),
                    @ColumnResult(name = "FLOORDESC", type = String.class),
                    @ColumnResult(name = "BLOCKID", type = Long.class),
                    @ColumnResult(name = "BLOCKCODE", type = String.class),
                    @ColumnResult(name = "BLOCKDESC", type = String.class),
                    @ColumnResult(name = "HKSCORE", type = Double.class),
                    @ColumnResult(name = "EMPID", type = Long.class),
                    @ColumnResult(name = "EMPCODE", type = String.class),
                    @ColumnResult(name = "EMPNAME", type = String.class),
                    @ColumnResult(name = "ROOMSTATE", type = String.class),
                    @ColumnResult(name = "BEDTYPEID", type = Long.class),
                    @ColumnResult(name = "BEDTYPECODE", type = String.class),
                    @ColumnResult(name = "BEDTYPEDESC", type = String.class),
                    @ColumnResult(name = "LOCID", type = Long.class),
                    @ColumnResult(name = "LOCCODE", type = String.class),
                    @ColumnResult(name = "LOCDESC", type = String.class)
            }),
            @ConstructorResult(targetClass = RoomHktaskListWrapper.class, columns = {
                    @ColumnResult(name = "ID", type = Long.class),
                    @ColumnResult(name = "ROOMNO", type = String.class),
                    @ColumnResult(name = "ROOMTYPEID", type = Long.class),
                    @ColumnResult(name = "ROOMTYPE", type = String.class),
                    @ColumnResult(name = "ROOMTYPEDESC", type = String.class),
                    @ColumnResult(name = "TRANSDATE", type = LocalDate.class),
                    @ColumnResult(name = "FLOORID", type = Long.class),
                    @ColumnResult(name = "FLOORCODE", type = String.class),
                    @ColumnResult(name = "FLOORDESC", type = String.class),
                    @ColumnResult(name = "BLOCKID", type = Long.class),
                    @ColumnResult(name = "BLOCKCODE", type = String.class),
                    @ColumnResult(name = "BLOCKDESC", type = String.class),
                    @ColumnResult(name = "HKSCORE", type = Double.class),
                    @ColumnResult(name = "EMPID", type = Long.class),
                    @ColumnResult(name = "EMPCODE", type = String.class),
                    @ColumnResult(name = "EMPNAME", type = String.class),
                    @ColumnResult(name = "ROOMSTATE", type = String.class),
                    @ColumnResult(name = "BEDTYPEID", type = Long.class),
                    @ColumnResult(name = "BEDTYPECODE", type = String.class),
                    @ColumnResult(name = "BEDTYPEDESC", type = String.class),
                    @ColumnResult(name = "LOCID", type = Long.class),
                    @ColumnResult(name = "LOCCODE", type = String.class),
                    @ColumnResult(name = "LOCDESC", type = String.class),
                    @ColumnResult(name = "GID", type = UUID.class)
            })
    })

И именованный запрос:

@NamedNativeQuery(name = "Room.getRoomHktaskListWrapper", query = "select * from SP_ROOM_HKTASK_LIST (:transdate, :roomtype, :roomno, :blockid, :floorid, :incassigned, :hotelrefno)", resultSetMapping = RoomHktaskListWrapper.ROOMHKTASKLISTWRAPPER)

Проблема в том, что администратор БД может добавить поле "gid" в хранимую процедуру.Я пытаюсь найти решение, которое подходит для обоих случаев.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...