As stated before, the Identity of an Entity is what defines it. So then, handling it is an important aspect of the Entity. There are usually four ways to define the Identity of an Entity: the persistence mechanism provides the Identity, a client provides the Identity, the application itself provides the Identity, or another Bounded Context provides the Identity.
Usually, the simplest way of generating the Identity is to delegate it to the persistence mechanism, because the vast majority of persistence mechanisms support some kind of Identity generation — like MySQL's AUTO_INCREMENT
attribute or Postgres and Oracle sequences. This, although simple, has a major drawback: we won't have the Identity of the Entity until we persist it. So to some degree, if we're going with persistence mechanism-generated Identities, we'll couple the Identity operation with the underlying persistence store:
CREATE TABLE `orders` ( `id` int(11) NOT NULL...