Skip to content
New issue

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

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

Already on GitHub? # to your account

findAllById with projection "The query used a deprecated function: id." #2848

Open
te3ex opened this issue Dec 20, 2023 · 5 comments
Open

findAllById with projection "The query used a deprecated function: id." #2848

te3ex opened this issue Dec 20, 2023 · 5 comments
Assignees
Labels
status: feedback-provided Feedback has been provided

Comments

@te3ex
Copy link

te3ex commented Dec 20, 2023

Hello,

Using Spring data neo4j 7.2.1
having the configuration : withDialect(Dialect.NEO4J_5)

the built in method from repository
ArisClass findAllById(Iterable iterable);
return the correct answer,

but
Collection findAllById(Iterable iterable, Class type);
return always an empty collection with the log : The query used a deprecated function: id.
whatever I put for the type , it happend with a projection as with the domain class.

regards

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 20, 2023
@meistermeier meistermeier self-assigned this Dec 20, 2023
@meistermeier
Copy link
Collaborator

That's odd. There should have been a fix in place to avoid the usage of the id function in every case now.
Could you provide an example and/or the generated Cypher query and the warning message? The logger for configuration is: org.springframework.data.neo4j.cypher and needs to be set to debug.

@meistermeier meistermeier added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 20, 2023
@te3ex
Copy link
Author

te3ex commented Dec 20, 2023

from the log I got :

2023-12-20T11:51:29.633+01:00  WARN 11872 --- [nio-8061-exec-1] org.springframework.data.neo4j.cypher    : Neo.ClientNotification.Statement.FeatureDeprecationWarning: This feature is deprecated and will be removed in future versions.
	MATCH (myClass:`my_class`) WHERE id(myClass) = $iterable WITH collect(elementId(myClass)) AS __sn__ RETURN __sn__

my repo is :

public interface myClassRepository extends Neo4jRepository<myClass, String> {

    <T> Collection<T> findAllById(Iterable<String> iterable, Class<T> type);

with this bean created :

	@Bean
	Configuration cypherDslConfiguration() {
		return Configuration.newConfig()
				.withDialect(Dialect.NEO4J_5).build();
	}

many thanks in advance.

@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 Dec 20, 2023
@meistermeier
Copy link
Collaborator

I assume that you have something in MyClass that looks like this:
@Id @GeneratedValue Long id. This would needed to get changed into a String.
The elementId is a String with colons like 4:7900ccce-91de-4f45-9742-60769f466719:2 and cannot be converted into a Long.

@meistermeier meistermeier added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Dec 20, 2023
@te3ex
Copy link
Author

te3ex commented Dec 20, 2023

My domain class is :

@node("my_class")
@DaTa
@NoArgsConstructor
@accessors(chain = true)
@EqualsAndHashCode
public class MyClass implements IdentifiableClass {

@Id
@GeneratedValue
private String id;

@DynamicLabels
private List<String> labels;

....

And my projection DTO is :

@DaTa
@NoArgsConstructor
@EqualsAndHashCode
public class MyClassDTOProjection {

private String id;

private List<String> labels;

.....

regards,

@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 Dec 20, 2023
@Copystrike

This comment was marked as resolved.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: feedback-provided Feedback has been provided
Projects
None yet
Development

No branches or pull requests

4 participants