LazyInitializationException - OrderService
Posted: Wed Nov 26, 2014 12:44 pm
I have a custom class in my own package in the site module. It is a @Service class and I have put @Transactional("blTransactionManager") to both the class as well as the method in which I have called the orderService.save() method.
Also I found that when I am trying to inject OrderService into the class, it isn't being injected. I added the package of the class in core module applicationContext.xml file using <context:component-scan>
This is the error I am getting
Code: Select all
@Transactional("blTransactionManager")
private void changeOrderStatus(Order order,OrderService orderService)
{
order.setStatus(OrderStatus.SUBMITTED);
try {
orderService.save(order, true);
System.out.println("order saved");
} catch (PricingException e) {
System.out.println("Exception occured while saving order");
e.printStackTrace();
}
}
Also I found that when I am trying to inject OrderService into the class, it isn't being injected. I added the package of the class in core module applicationContext.xml file using <context:component-scan>
This is the error I am getting
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.broadleafcommerce.core.order.domain.OrderImpl.addedOfferCodes, could not initialize proxy - no Session