Wednesday 30 November 2011

Spring proxies: JDK vs. CGLib

This page contains an excellent and succinct summary of Spring Proxies:

http://insufficientinformation.blogspot.com/2007/12/spring-dynamic-proxies-vs-cglib-proxies.html

You could read a chapter in most Spring books and learn less.  Heed the advice: "Most important proxy-based AOP only works from "outside". Internal method calls are never intercepted."  If you don't already understand this, take the time to do so.

The Spring reference manual is also a good read:

http://static.springsource.org/spring/docs/3.0.0.RELEASE/spring-framework-reference/html/aop.html#aop-proxying

"...once the call has finally reached the target object, the SimplePojo reference in this case, any method calls that it may make on itself, such as this.bar() or this.foo(), are going to be invoked against the this reference, and not the proxy. This has important implications. It means that self-invocation is not going to result in the advice associated with a method invocation getting a chance to execute.

Okay, so what is to be done about this? The best approach (the term best is used loosely here) is to refactor your code such that the self-invocation does not happen."

Monday 14 November 2011

Studio Express to MSDE 2000 connection problem

Fresh install of SQL Server 2000 (MSDE 2000) on a Windows XP box.  Want to connect remotely via Studio Express, but get following error:

Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server Connection ... (Error: 18542)

Fix: set to mixed-mode login authentication in registry, restart SQL Server
HKLM\Software\Microsoft\MSSqlserver\MSSqlServer\LoginMode  (change 1 to 0)

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q285097
http://www.microsoft.com/download/en/details.aspx?id=22661