Kieren Johnson wrote:HQL does not refer directly to tables in the database but instead refers to the classes that these tables are mapped to in your hibernate mapping files (or annotations). This means that your code does not need to know anything about the database that it is attached to and this is a good thing.
If you decided to port your application to another database system and, in a fit of madness, to change all the table names then all you need to change in your application are the hibernate mappings, you wouldn't need to touch any part of your code. Neat, huh?
The main problem is not table names, but SQL dialect. Different RDBMS use different SQL dialects.
That is the reason why Hibernate introduced HQL, SQL will be generated by Hibernate, so if we want to change RDBMS, we just change dialect instead of take a look at all SQL statements and convert SQL from dialect A to dialect B.
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional