ordering column is used as the offset. It’s implemented using an auto-incrementing sequence, so it is unique across the entire set of events.
sequence_number column is relative to a particular persistence ID, so it can’t be used for ordering events across different entities.
The persistence ID is determined by combining the entity type name and the entity ID. By default, the entity type name is the abbreviated (without package qualifier) class name of the persistent entity, but you can change this by overriding the
entityTypeName method (for example, if you want to change the class name without affecting data that has already been persisted).
The mapping from entity ID to persistence ID is slightly different between Java and Scala. You can find the implementation in
PersistentEntityActor (Java/Scala). The only difference is that the Scala implementation puts a
| separator between the prefix and the ID, while the Java implementation does not.