java - Spring not giving current session without marking @Transactional -
java - Spring not giving current session without marking @Transactional - using spring sessionfactory injection. @suppresswarnings("unchecked") public void getdata() { system.out.println("%%%% hibernate fetching info %%%% "); session session = factory.getcurrentsession(); /* * seek { thread.sleep(10000); } grab (interruptedexception e) { // todo * auto-generated grab block e.printstacktrace(); } */ list<address> addresses = session.createquery("from address").list(); system.out.println("total connectins = " + factory.getstatistics().getconnectcount()); (address address : addresses) { system.out.println(address); } } above code giving exception org.hibernate.hibernateexception: no session found current thread but when method marked @transactional it's working fine. don't want transaction enabled...