my2iu / Jinq

LINQ-style queries for Java 8
Other
659 stars 71 forks source link

java.util.UUID not supported #70

Closed JGasp closed 6 years ago

JGasp commented 6 years ago

I would like to see java.util.UUID added to supported types.

my2iu commented 6 years ago

What do you mean by UUID? A SQL UUID? A Hibernate UUID? Are you representing your UUID in Java as Strings or as UUID objects?

JGasp commented 6 years ago

JPA: Hibernate bundled with Wildfly 10.0.0. Database: PostgreSQL 10

There is some bug with PostgreSQL 10, so that JPA generates schema where UUID is represented as binary data in PostgreSQL. Work around for this is to define following property <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL94Dialect"/> , which resolves this issue and uses PostgresSQL data type UUID.

I was using JINQ in previous project where id was represented as Integer. In this project we are using UUID. When i try to execute the following JINQ query

final UUID authId = authEntity.getId(); List[UserAccount] uaList = source.getStream(UserAccount.class) .where(e -> e.getId().equals(authId)).toList();

It fails to generate query.

This is my id representation in class.

@Id @Column(name = "id", columnDefinition = "uuid", updatable = false) private UUID id;

For more info visit gist link, that contains 2 generic classes that are used in my example https://gist.github.com/JGasp/2993df9cca05b8c64f78ac8a013c6fa3

my2iu commented 6 years ago

Ok, I'm a bit busy at the moment. I probably won't have the time to look at this for a couple of days.

my2iu commented 6 years ago

I've released a version 1.8.23 to Maven that has support for UUID. It seems to work with Hibernate, but I haven't had much luck getting it to work with EclipseLink. I'll update the website with the release later in the week.