Code:
Theme returnedTheme2 = (Theme)session.load(Theme.class, new Integer(themeId));
System.out.println("RETURNED THEME 2 ID : " + returnedTheme2.getId());
This is what makes using proxies possible: if you get only the primary key from the proxy, it needs not be initialized.
Basically what most likely happens to you is:
1. with load() you get a proxy
2. you get the key of the proxy, so the actual db row is never loaded
Try this:
Hibernate.initialize(returnedTeheme2);
Or access any non-key field, that should also initialize the proxy. Or alternatively, you can disable proxies.
Also note that the exception thrown will most likely not be of type HelperException, that you are trying to catch.
Roland