Skip to content

org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.query.SyntaxException: At x:xx and token ')', no viable alternative at input #3906

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

Closed
lasselindqvist opened this issue Jun 2, 2025 · 2 comments
Labels
status: duplicate A duplicate of another issue

Comments

@lasselindqvist
Copy link

Updating automatically to Spring Boot 3.5.0 gave me

service | org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.query.SyntaxException: At 1:41 and token ')', no viable alternative at input 'SELECT new domain.Table(*) FROM Table t WHERE t.linkedId = :linkedId AND NOT t.id = :originalId' [SELECT new domain.Table() FROM Table t WHERE t.linkedId = :linkedId AND NOT t.id = :originalId]
service | 	at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:371) ~[spring-orm-6.2.7.jar:6.2.7]

The query itself is defined as

	@Query(value = """
			SELECT t FROM Table t
			WHERE t.linkedId = :linkedId
			AND NOT t.id = :originalId
			""")
	Table findOtherCustomershipByLinkedCustomershipId(@Param("linkedId") Long linkedId,
			@Param("originalId") Long originalId);

This worked previously and return a "Table" object. Could be an issue in Hibernate or spring-orm or spring-data-jpa. I am not sure. Or then this syntax was never supported?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 2, 2025
@mp911de
Copy link
Member

mp911de commented Jun 2, 2025

What domain type do you use in the repository (e.g. how does your extends Repository<…> part look like)?

This one looks like a duplicate of #3895

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Jun 2, 2025
@lasselindqvist
Copy link
Author

The query is in a Repository for another table, not the "Table" used there in the example.
But seems like a duplicate for the mentioned issue.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 2, 2025
@mp911de mp911de added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Jun 2, 2025
@mp911de mp911de closed this as completed Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants