Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup query mapping resolution of properties #3620

Open
mp911de opened this issue Apr 9, 2021 · 1 comment
Open

Cleanup query mapping resolution of properties #3620

mp911de opened this issue Apr 9, 2021 · 1 comment
Labels
type: task A general task

Comments

@mp911de
Copy link
Member

mp911de commented Apr 9, 2021

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.

@SubashL
Copy link

SubashL commented Apr 9, 2021

Criteria object is not failing in is clause. It is only failing with clauses like in and exists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants