Wednesday, September 07, 2011

Tracking Hibernate SQL query and parameters

Every developer using Hibernate might need to know the SQL it generates and the parameters being sent. Normally to have the sql printed out to console, one only have to configure hibernate property show_sql to true. However the parameters are not printed out.

Luckily for me, I found this post on configuring the necessary log level to be able to print out the sql and parameters. Here are the configuration that I used:

<logger name="org.hibernate.sql">
<level value="debug" />
<appender-ref ref="console"/>
</logger>

<logger name="org.hibernate.impl.SessionImpl">
<level value="debug" />
<appender-ref ref="console"/>
</logger>

<logger name="org.hibernate.engine.QueryParameters">
<level value="debug" />
<appender-ref ref="console"/>
</logger>

<logger name="org.hibernate.type">
<level value="debug" />
<appender-ref ref="console"/>
</logger>


For the moment, I think these satisfy my need :)

Tuesday, September 06, 2011

Expiring remote desktop certificate

Recently each time I need to connect remotely to one of the servers in my office, I always get certificate expired kind of error. As my curiosity drove me and based on the keyword "expired", I went to the server and accessed the console to check the server's date. It turned out that somehow the date and time of the server went back to 2002 (hey, I write this on 2011 :).
At first, I thought a simple update of the time on the server will fix this. Unfortunately the result was still the same. Googling around and found this link which helped me fixing the issue. Below are the steps which I executed on my computer along with some screenshots:

1. Open mmc.exe

2. On the file menu, click Add/remove snap-in
3. Click certificates, and then click add

4. Choose computer account and click Next

5. On the following dialog, as in my case, I choose another computer and put in the server name. Click Finish to continue

5. Back on the main window, expand the certificate node and choose Remote Desktop certificates.

6. On the middle section, the certificate which expired is displayed. Just delete it by right clicking and choose delete.

In short, we need to *renew* the certificate simply by deleting it and let windows recreate it later.

In case you cannot do it from your computer, you can always go to the server's console and do it there :) .... if you have the permission.....