Skip to content

Illegal attempt to dereference path source [null.events] of basic type #6

@nikez

Description

@nikez

Hi!

I tried to incorporate this to a project I'm working with but I can't seem to get it to work.

This works just fine (Without your filter)

CriteriaBuilder cb = entityManager.getCriteriaBuilder();

CriteriaQuery<Message> query = cb.createQuery(Message.class);

Root<Message> root = query.from(Message.class);
Join<Message, Event> join = root.join("events", JoinType.INNER);
query = query
	.select(root)
	.where(
		cb.equal(join.get("eventType"), Event.EventType.SENT)
	);
return entityManager.createQuery(query).getResultList();

However, trying to do the same with

selectFrom(messageRepository).innerJoin("events").where(filter).findAll();

and in-data
{ "field": "events.eventType", "operator": "eq", "value": "SENT" }

Results in the following error:

exception.GlobalControllerExceptionHandler - global controller exception handler encountered exception: SpecificationException message: Meet problem when parse field path: events.eventType, this path does not exist. Illegal attempt to dereference path source [null.events] of basic type

SpecificationException: Meet problem when parse field path: events.eventType, this path does not exist. Illegal attempt to dereference path source [null.events] of basic type

Caused by: java.lang.IllegalStateException: Illegal attempt to dereference path source [null.events] of basic type

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions