PojoRepository.write,
each pojo class must have one and only one property annotated with
the Id annotation. The property annotated with Id is used to
generate a unique URI in MarkLogic Server for each persisted
instance, and thus should be a property with a unique value for
each instance.
import com.marklogic.client.pojo.annotation.Id;
public class MyClass {
@Id
public Long myId;
}
or with a public getter method:
public class MyClass {
private Long myId;
@Id
public Long getMyId() {
return myId;
}
// ... setter methods ...
}
or with a public setter method:
public class MyClass {
private Long myId;
// ... getter methods ...
@Id
public void setMyId(Long myId) {
this.myId = myId;
}
}
This annotation is used only at runtime to generate unique uris, so
there is no need to run GenerateIndexConfig
to do anything with this annotation.Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.