We use project reactor in our GRPC service. Right now its just hibernate ORM and I thought I should move to hibernate-reactive and make it reactive all the way to improve performance. I am kind of stuck with this issue on how I can proceed further.
@UuidGenerator
@Column(columnDefinition = "uuid")
private UUID id
Caused by: java.lang.ClassCastException: class java.util.UUID cannot be cast to class io.vertx.core.buffer.Buffer (java.util.UUID is in module java.base of loader ‘bootstrap’; io.vertx.core.buffer.Buffer is in unnamed module of loader ‘app’)
I referred to documentation here - Hibernate Reactive 2.4.8.Final Reference Documentation
I cannot have a custom ReactiveIdentifierGenerator because as I said I need to have both ORM and Reactive. So how do I make the UuidGenerator work here with reactive?
So do you really need to use @UuidGnenerator, or is it enough to write standard JPA, that is:
@Id
@GeneratedValue
UUID id;
This should, I believe, work in both ORM and in Reactive.
Currently I have a custom uuid generator. But I was ok to just have the @IdIdIdId an@GeneratedVa@GeneratedValueue @GeneratedValue though. Even with just those annotations, I am still getting the same exception.
I enabled the SQL logs. And the stack above has Error while fetching assets for org.hibernate.HibernateException: Unable to extract JDBC value for position 1
Position 1 here is just a regular UUID column not ev@Columnn the ID column
@Column(nullable = false, columnDefinition = “uuid”)
private UUID tenantId;
Update:
FWIW, the query I am trying here is pretty complicated.. so may be this level of sub-queries is causing the abstraction at vertx driver to fail.. I don know!
Attaching the query for reference as well
SELECT * FROM (SELECT * FROM assets WHERE NOT deleted AND tenant_id = $1 AND accounts[1] = $2 AND (CAST($3 AS text) IS NULL OR type = $4) AND (CAST($5 AS text) IS NULL OR type ^@ $6) AND (CAST($7 AS text) IS NULL OR type_id = $8) AND created >= $9 AND created < $10 AND (CAST($11 AS timestamp) IS NULL OR last_modified >= $12) AND (CAST($13 AS timestamp) IS NULL OR last_modified < $14) AND (CAST($15 AS jsonb) IS NULL OR system_tags @> CAST($16 AS jsonb)) AND (CAST($17 AS jsonb) IS NULL OR user_tags @> CAST($18 AS jsonb)) AND (CAST($19 AS jsonb) IS NULL OR reported_properties @> CAST($20 AS jsonb)) ORDER BY created DESC, id DESC LIMIT $21) lessThanCreatedEnd UNION ALL SELECT * FROM (SELECT * FROM assets WHERE NOT deleted AND tenant_id = $22 AND accounts[1] = $23 AND (CAST($24 AS text) IS NULL OR type = $25) AND (CAST($26 AS text) IS NULL OR type ^@ $27) AND (CAST($28 AS text) IS NULL OR type_id = $29) AND created = $30 AND id < $31 AND (CAST($32 AS timestamp) IS NULL OR last_modified >= $33) AND (CAST($34 AS timestamp) IS NULL OR last_modified < $35) AND (CAST($36 AS jsonb) IS NULL OR system_tags @> CAST($37 AS jsonb)) AND (CAST($38 AS jsonb) IS NULL OR user_tags @> CAST($39 AS jsonb)) AND (CAST($40 AS jsonb) IS NULL OR reported_properties @> CAST($41 AS jsonb)) ORDER BY created DESC, id DESC LIMIT $42) equalToCreatedEnd ) as mergedResult ORDER BY created DESC, id DESC LIMIT $43
Well that sounds more like a bug then. It’s a bit surprising, because we do have tests for @Id @GeneratedValue UUID.
Anyway, if you can reproduce this in a simple, isolated, test, please go ahead and report it.