You can achieve the same 'fetch or create' entity functionality in Java using a simple
'try/catch' block. This is essentially the same way the Python 'get_or_insert()' method works, and you can therefore simply add this in your code manually. You can find our
Java documentation explaining this specific use of transactions, as seen in the second provided example.