I have the following query in Hibernate:

```
val em: EntityManager = ...
em.createQuery("SELECT id FROM Segment s WHERE $condition", Long::class.java)
val result = q.resultList

```

When running it I get the following error:

```
Type specified for TypedQuery [long] is incompatible with query return type [class java.lang.Long]

```