Zdravim, mam nasledujici klientsky kod komunikujici se spring aplikacni vrstvou (pomoci Spring's HTTP Invoking).
public class MyTest { public static void main(String[] args) { System.out.println(args[0]); XmlBeanFactory beanFactory = new XmlBeanFactory(new FileSystemResource(args[0])); IStockItemService service = (IStockItemService) beanFactory.getBean("myservice"); System.out.println("find item by id 5:"); StockItem item = service.findStockItemById(5); String str = null; str = ""+item.getId(); // str += item.getDescription(); // str += ""+item.getPrice(); System.out.println(str); System.out.println("added item:"); System.out.println(service.saveNewStockItem(new StockItem("Ahoj",29))); System.out.println("all items:"); List list = service.getStockItemList(null); for (Object o : list) System.out.println(o); } } takhle probehne vse v poradku. Ale pokud se snazim zavolat metody objektu item getDescription() ci getPrice(), vyskoci nasledujici chybova hlaska: find item by id 5: (hibernate.LazyInitializationException 19 ) could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98) at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158) at com.gola.cobra.bo.StockItem$$EnhancerByCGLIB$$975d2856.getDescription(<generated>) at com.gola.cobra.client.MyTest.main(MyTest.java:19) Exception in thread "main" org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53) at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98) at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:158) at com.gola.cobra.bo.StockItem$$EnhancerByCGLIB$$975d2856.getDescription(<generated>) at com.gola.cobra.client.MyTest.main(MyTest.java:19)