What defines the identity of an entity?
I don’t like the definition of the term given in the context of object orientation, so I’ll just put what’s on Wikipedia not to give a definition of my own:
An identity in object-oriented design and object-oriented analysis describes the property of objects that differentiates them from other objects. This is closely related to the philosophical concept of identity.
In terms of real identity of objects in the most universal sense this does not fit well, but the question has a more specific context.
Only database id defines an entity’s identity?
Not necessarily, but it is very common that it is him in the database. I suggest to take a look at Surrogate Key and Natural Key. The id
may be the identifier of that line in the database.
It is not necessarily the identity of that logical entity from the point of view of business modeling. It can be another code, a document number, or even a (rarer) name. It can even be the id
also, if the business model still makes sense with that.
From the point of view of the data bank mechanism the primary key used will be the identity, where the id
or not. But reinforcement that only applies to the SGDB, on the business model depends.
Which criterion defines the identity that characterizes an entity?
Depending on each entity, the biggest reason is that it is unique in every data collection. Identity can even be composed of multiple data. In the database it’s usually the id
because he’s unique.
From the strict point of view of object orientation there are no rules so specific beyond oneness.
The question is a little confusing for putting the tag of OOP and talk of database, where the term has different meanings, including in some contexts, such as DDD only to quote one, may have specificities on these rules.
Identity is not any characteristic that uniquely determines an instance of this entity?
– anonimo
identity is an attribute that defines a unique value to identify an element of that entity. ID is a, CPF for example is the tax identity of a citizen, the name may be the same, but the CPF will not, and so on. The criterion is simple: a single attribute, which does not repeat, which makes it possible to identify a single element of the entity. An entity for example of State, could be the acronym (AC, AL, AP, AM, etc)
– Ricardo Pontual