Hibernate HQL to SQL Translation

For debugging purposes using hibernate it’s often usefull to have the generated SQL query to an appropriate HQL query.
But setting the hibernate configuration hibernate.show_sql to true leads to logging any query made within an application (which can be a lot in some applications). With the following class the hibernate API is used to generate the correct SQL query from a given HQL query and can be used anywhere to log the generated query.
“Hibernate HQL to SQL Translation” Weiter lesen

mysqldump backup with import & export

Kurz notiert:
Create a mysql-dump which can be easily imported again:

mysqldump -f --add-drop-table --user=MYSQL_USERNAME 

Additional gzip-compression:

mysqldump -f --add-drop-table --user=MYSQL_USERNAME 
  --password=MYSQL_PASSWORD DATABASE-NAME | gzip --best > DATABASE-DUMP.sql.gz 

Load a dump back into a database: