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.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.