aspose file tools*
The moose likes Object Relational Mapping and the fly likes created hibernate SQL confusing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "created hibernate SQL confusing" Watch "created hibernate SQL confusing" New topic

created hibernate SQL confusing

Scott Stephens

Joined: Jun 25, 2011
Posts: 20

When I use the following with an embedded Derby Database:

Hibernate creates the following SQL Statement:


however, when I use this

Hibernate generates


Here is my class mapping :

Maybe someone has some tips!
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

Welcome to ORM land. In your first example, Hibernate "knows" what it wants and generates SQL accordingly.
In the second you are bypassing Hibernate with native SQL so it basically does what you told it.

Scott Stephens

Joined: Jun 25, 2011
Posts: 20

Thanks. The "?" seems funny. Both snippets, however, return an object!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: created hibernate SQL confusing
Similar Threads
XDoclet does not generate Interfaces
Help with mapping set - Hibernate
Need help in using tags for below code
Hibernate Collections - have lots of null elements aswell as my objects
DATABASE ERROR: java.sql.SQLException: Invalid argument(s) in call