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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "created hibernate SQL confusing" Watch "created hibernate SQL confusing" New topic
Author

created hibernate SQL confusing

Scott Stephens
Greenhorn

Joined: Jun 25, 2011
Posts: 23

When I use the following with an embedded Derby Database:



Hibernate creates the following SQL Statement:

Hibernate:


however, when I use this



Hibernate generates

Hibernate:
select
*
from
PERSOAPP.PERSONAL
where
PERSON_ID =1

Here is my class mapping :

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

Joined: Mar 28, 2012
Posts: 859

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.

WP
Scott Stephens
Greenhorn

Joined: Jun 25, 2011
Posts: 23

Thanks. The "?" seems funny. Both snippets, however, return an object!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: created hibernate SQL confusing