This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Named Queries in hibernate

 
Gopi Kiran Manusani
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
below is my SQL query


here below is mapping for named query


The error i get is as follows
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 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
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic