Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

created hibernate SQL confusing

 
Scott Stephens
Greenhorn
Posts: 23
Debian Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
Debian Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. The "?" seems funny. Both snippets, however, return an object!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic