It's not a secret anymore!
The moose likes Object Relational Mapping and the fly likes Named Queries in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Named Queries in hibernate" Watch "Named Queries in hibernate" New topic

Named Queries in hibernate

Gopi Kiran Manusani

Joined: Nov 02, 2009
Posts: 9
below is my SQL query

here below is mapping for named query

The error i get is as follows
Caused by: The column name productN1_0_ is not valid.

I request anybody please help me to resolve the problem.Can you please tell me where exactly going wrong
Makni Mono

Joined: Feb 15, 2010
Posts: 3
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
I agree. Here's the link:
subject: Named Queries in hibernate
It's not a secret anymore!