HQL is typically a lot more fun, and a lot easier to write than SQL. It's also usually a lot cleaner and more compact. However, it can still feel wrong to embed HQL into your Java code when not necessary; it makes it harder to maintain and makes Java code a lot uglier. Criteria style queries (as described in this Javalobby Spotlight Feature: Hibernate Querying 102: The Criteria API ) are an alternative option, although as the article above suggests, they are more appropriate when the query you want to execute should be dynamically generated. What would be really great would be to use the criteria API whenever we need to programmatically produce queries, and externalize any HQL queries that can be statically defined. Thankfully, Hibernate has a solution.
Hibernate supports a feature called 'named queries', which simply allows queries to be written directly in your mapping document(s), and keyed by a name. Not only does this allow you to externalize your HQL, but it also lets you put the HQL written for certain object mapping structures in the same place as the definition for those mapping structures themselves.
low cost affordable ivf florida how to convert videos for free