• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Named Queries in hibernate

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic