Hi all,
In case of a state-stored aggregate, is it possible to have the persistence id separate from the aggregate identifier?
What I try to achieve here is to use a sequence as the primary key and not the aggregate identifier, if possible.
It works for creating a new state but when I try to send a command that updates the state the command gateway throws an error.
For instance:
`
@Entity
@Aggregate
public class MyAggregate {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long persistenceId;
@AggregateIdentifier
private MyValueObjectId myValueObjectId;
…
}
`
`
public class MyCommand {
@TargetAggregateIdentifier
public final MyValueObjectId myValueObjectId;
…
}
`
Error: Provided id of the wrong type … Expected: class java.lang.Long, got java.lang.String.
Kind regards,
Nick