i am lokking for an option which has no impact during migration
Migration always has an impact.
This really depends on how complicated your query is. As was mentioned, using the Criteria API (
tutorial here) will allow you to write your code using your
Java objects, and remove a dependency on your database structure. Of course, SQL is pretty standard, so assuming your query isn't overly complicated,
you should be fine.
Of course, if someone goes and changes the structure of your database, there's not much you're going to be able to do, criteria or SQL formula solution.
-Cameron McKenzie