Every Mendix object has a unique id, which can be used in a database retrieve.
You can read more about in the documentation here:
In corner cases, with complicated XPATH, I have written the XPATH like given below. But it is not common in simple DB retrieval.
For example:
In general we write something like Mymodule.ObjectA_ObjectB = $ObjectA
But we can also write it as: Mymodule.ObjectA_ObjectB/MyModule.ObjectA/id = $ObjectA
Otherwise, few cases as listed in the link that Lennart posted already.