File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 23

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: 23

Thanks. The "?" seems funny. Both snippets, however, return an object!
jQuery in Action, 2nd edition
subject: created hibernate SQL confusing
Similar Threads
Hibernate Collections - have lots of null elements aswell as my objects
Need help in using tags for below code
XDoclet does not generate Interfaces
Help with mapping set - Hibernate
DATABASE ERROR: java.sql.SQLException: Invalid argument(s) in call