SDN - Applying @RelationshipId to an External key causes an Exception

I found that a Node-entity with a natural key or an external id (generated by the application) annotated with @Id would not cause any trouble.

Meanwhile, an attempt to define an entity representing a relationship (annotated with @RelationshipProperties) without making use of internal id causes an exception (fragment):

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'neo4jTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.class]: Unsatisfied dependency expressed through method 'neo4jTemplate' parameter 1:
Error creating bean with name 'neo4jMappingContext' defined in class path resource [org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.class]:
Internally generated ids can only be assigned to one of [class java.lang.Long, interface org.springframework.data.neo4j.core.schema.ElementId, long]

Here's a minimal reproducible example:

@RelationshipProperties
@Getter
@Setter
public class FooRelationship {
    @RelationshipId
    private String naturalKey;
    @TargetNode
    private FooNode target;
}

In this example, the value of the naturalKey is always expected to be provided (hence there's no @GeneratedValue annotation).

If instead, this relationship would make use of the internal id:

@RelationshipProperties
@Getter
@Setter
public class FooRelationship {
    @RelationshipId
    @GeneratedValue
    private Long id;
    private String foo;
    @TargetNode
    private FooNode target;
}

there would be a warning suggesting using an externally generated id.

But with the following version specifying an externally generated id the application would fail to run:

@RelationshipProperties
@Getter
@Setter
public class FooRelationship {
    @RelationshipId
    @GeneratedValue(GeneratedValue.UUIDGenerator.class)
    private String uuid;
    @TargetNode
    private FooNode target;
}

Exception (fragment):

Caused by: java.lang.IllegalStateException: The class ... .FooRelationship for the properties of a relationship is missing a property for the generated, internal ID (@Id @GeneratedValue Long id) which is needed for safely updating properties

SDN dependency:

    <dependency>
      <groupId>org.springframework.data</groupId>
      <artifactId>spring-data-neo4j</artifactId>
      <version>7.0.6</version>
      <scope>compile</scope>
    </dependency>

Am I missing something?

The first snippet is technical correct as it is, the @RelationshipId is a convenience wrapper around @Id and @GeneratedValue.
It is not a natural key but instead uses the elementId (instead id) function of the database to retrieve the identifier and work with it.
Note
At the moment there seems to be a bug when using relationships with elementIds, unless SDN / Cypher-DSL knows that it is talking with a Neo4j version 5 instance.
To make the Cypher-DSL, that generates the statements, aware that we want to use elementId you have to define the NEO4J_5 dialect by creating a (Cypher-DSL) Configuration bean.

@Configuration
public class SomeConfigurationClass {
  /**.... other things **/

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

Edit: Did not think this through. Updated the needed code.

Thanks for your reply. I've tried the recipe you suggested. With org.neo4j.cypherdsl.core.renderer.Configuration bean specifying Dialect.NEO4J_5 the warning goes away.

But it's unfortunate that Relationship-entities are confined to use only elementId as a key. And I didn't expect that because Nodes do support external keys.

The possibility to provide external keys (for instance UUID generated by the client app) would be handy.

Are there any plans to change this behavior?

Nodes are the only real entities, we want to support in SDN. RelationshipProperties only have an (internal) id definition, to have a handle for updates, etc. That is also the reason why there is no further support for custom ids on them.
But on the other hand, I would be interested why you ask for this? You might have also already noticed that repositories and Neo4jTemplate only work with nodes.