It happens automatically. The dataTable uses your ID as a model, but the full ID is decorated to make it unique.
In th case of JSF message components, things (again) are handled automatically. If you're generating your own message, it needs to be a property for the row of the model that your dataTable is displaying.
An IDE is no substitute for an Intelligent Developer.