tomdavies
tomdavies

Reputation: 1976

Hibernate queries - why are they so weird?

I was just looking at console and I notices Hibernate queries are looking werid.

Hibernate: select client0_.id as id1_1_0_, client0_.address as address2_1_0_, client0_.name as name3_1_0_, client0_.client_no as client_n4_1_0_, client0_.ssn as ssn5_1_0_ from clients client0_ where client0_.id=?

Hibernate: select orders0_.CLIENT_ID as CLIENT_I5_1_0_, orders0_.id as id1_0_0_, orders0_.id as id1_0_1_, orders0_.CLIENT_ID as CLIENT_I5_0_1_, orders0_.ORDER_DATE as ORDER_DA2_0_1_, orders0_.ORDER_DESC as ORDER_DE3_0_1_, orders0_.ORDER_NO as ORDER_NO4_0_1_ from ORDERS orders0_ where orders0_.CLIENT_ID=?

Is this some kind of HQL?

Regards.

Upvotes: 0

Views: 118

Answers (2)

mahesh
mahesh

Reputation: 1331

Hibernate Query Language(HQL) helps to write Queries in object oriented way.So that we are free to migrate from one data base management system to other. For example MySQL to Oracle DB or vice versa.

The HQL is converted in to SQL by Hibernate. The same happens for Criteria queries too.

For example:

         HQL : from Student
         SQL : select * from student

Upvotes: 0

GreyBeardedGeek
GreyBeardedGeek

Reputation: 30088

No. It's not HQL - if you read it carefully, you'll see that it's straight-forward ANSI Sql. It has machine-generated, non-human-friendly column aliases, but it's sql.

Upvotes: 4

Related Questions