Skip to content

Cleanup query mapping resolution of properties #3620

Open
@mp911de

Description

@mp911de

We have code like this that tries to resolve a PropertyPath multiple times doing the same/similar thing multiple times:

try {

	if (entity.getPersistentProperty(path) != null) {
		return PropertyPath.from(Pattern.quote(path), entity.getTypeInformation());
	}

	return PropertyPath.from(path, entity.getTypeInformation());
} catch (PropertyReferenceException | InvalidPersistentPropertyPath e) {

	if (path.endsWith("_id")) {
		return forName(path.substring(0, path.length() - 3) + "id");
	}

	// Ok give it another try quoting
	try {
		return PropertyPath.from(Pattern.quote(path), entity.getTypeInformation());
	} catch (PropertyReferenceException | InvalidPersistentPropertyPath ex) {

	}

	return null;
}

We should revisit property resolution and simplify the code by avoiding duplications and refactoring it to a comprehensive form.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions