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

Enum query arguments not converted [DATACASS-521] #688

Closed
spring-projects-issues opened this issue Jan 25, 2018 · 0 comments
Closed

Enum query arguments not converted [DATACASS-521] #688

spring-projects-issues opened this issue Jan 25, 2018 · 0 comments
Assignees

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Jan 25, 2018

Mark Paluch opened DATACASS-521 and commented

Passing an enum value to a query method is not converted even if converters are registered:

	enum Condition {

		Good("+"), NotSoGood("-");

		private final String identifier;

		Condition(String identifier) {
			this.identifier = identifier;
		}

		public String getIdentifier() {
			return identifier;
		}
	}

	enum ConditionToStringConverter implements Converter<Condition, String> {

		INSTANCE;

		@Override
		public String convert(Condition source) {
			return source.getIdentifier();
		}
	}

	interface SampleRepository extends Repository<Person, String> {

		@Query("SELECT * FROM person WHERE condition=?0;")
		Person findByCondition(Condition condition);
	}

The resulting statement contains a Condition object instead of converting the enum value to String


Affects: 1.5.10 (Ingalls SR10)

Reference URL: https://stackoverflow.com/questions/48427966/enum-inner-field-as-parameter-of-spring-data-query-statement

Issue Links:

  • DATACASS-357 IN query converts collection arguments to singular value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants