Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-07-2022 06:18 AM
Hi there,
We are having a hard time upgrading from sdn 5.3.x to 6.2.
Our entities are inherited from a base domain object:
@SuperBuilder
@NoArgsConstructor
public abstract class BaseDomainObject {
@Id
@GeneratedValue(strategy = StringUuidStrategy.class)
@Getter
public String id;
@Id
@GeneratedValue
@Getter
private Long internalId;
}
And the entities do not contain an @Id itself.
@Node
@NoArgsConstructor
@SuperBuilder
public class Competence extends BaseDomainObject {
@Getter
@Setter
@Property
String name;
}
in sdn 5.3 this works just fine but sdn 6.2 throws with the following error message
Missing id property on class xxxxxx
Saw this PR where the check was added:
What's the proposed migration path for this issue?
Thank you in advice
01-07-2022 07:19 AM
Never mind. Had the wrong imports
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
instead of
import org.springframework.data.neo4j.core.schema.GeneratedValue;
import org.springframework.data.neo4j.core.schema.Id;
One question remains.
We need to get the internal id as well. How can we obtain that in the base class?
01-09-2022 10:59 PM
You can only have one identifying property in an entity (or its parent classes/interfaces).
Either treat the UUID as just another property or fetch the internal id manually with the Neo4jClient
and e.g. a Cypher statement with the UUID in the condition part, if the internal id is not needed all the time.
All the sessions of the conference are now available online