0

I am trying to use Hibernate native queries to select a single column from the database. The column type is an enumeration.

Java

public interface TicketSummary {

    TicketStatus getSummary();
}

@Repository
public interface TicketRepository extends JpaRepository<Ticket, TicketIdentity> {

    @Query(value = "SELECT status AS summary FROM ticket_service.ticket WHERE entitlement_id IN (:entitlementId)", nativeQuery = true)
    List<TicketSummary> findAllTicketsStatusSummary(UUID[] entitlementId);
}

SQL

CREATE TYPE ticket_service.ticket_state AS ENUM( 
    'CREATED',
    'IN_PROGRESS',
    'BLOCKED',
    'CLOSED',
    'COMPLETED'
);

I continuously get the following error when querying.

exception captured: No Dialect mapping for JDBC type: 1111; nested exception is org.hibernate.MappingException: No Dialect mapping for JDBC type: 1111

Debugging

Placing a breakpoint inside JdbcResultMetadata.getHibernateType displays the following

enter image description here

Kindly assist me in finding a solution to the same. Thank you in advance.

freshprinze
  • 134
  • 2
  • 10

0 Answers0