Skip to content

Commit

Permalink
Removed cascade-all type annotation from Order reference to Business
Browse files Browse the repository at this point in the history
class
  • Loading branch information
gregoavg committed Dec 30, 2013
1 parent 25c9173 commit ffda46d
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class CategoryController {

private static final Logger LOGGER = LoggerFactory
.getLogger(BusinessController.class);
.getLogger(CategoryController.class);

@Autowired
private ICategoryService categoryService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class MenuController {

private static final Logger LOGGER = LoggerFactory
.getLogger(BusinessController.class);
.getLogger(MenuController.class);

@Autowired
private IMenuService menuService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@RequestMapping(value = "/orders")
public class OrderController {

private static final Logger LOGGER = LoggerFactory.getLogger(BusinessController.class);
private static final Logger LOGGER = LoggerFactory.getLogger(OrderController.class);

@Autowired
private IOrderService orderService;
Expand All @@ -37,7 +37,7 @@ ResponseEntity<Void> createOrder(@RequestParam Long id, @RequestBody OrderDTO or
@RequestMapping(value = "/business", params = "id", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<PendingOrdersDTO> getOrdersByBusinessId(@RequestParam Long id) throws BusinessDoesNotExistException {
PendingOrdersDTO pendingOrders = orderService.fetchOrdersFromBusinessID(id);
LOGGER.info("Request for business orders.\nFetchedList size is ");
LOGGER.info("Request for business orders.\nFetchedList size is " + pendingOrders.getOrders().size());
return new ResponseEntity<PendingOrdersDTO>(pendingOrders, HttpStatus.OK);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@RequestMapping(value = "/products")
public class ProductController {

private static final Logger LOGGER = LoggerFactory.getLogger(BusinessController.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ProductController.class);

@Autowired
private IProductService productService;
Expand Down
4 changes: 2 additions & 2 deletions QorderWS/src/main/java/com/qorder/qorderws/dao/OrderDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public boolean delete(Order order) {
return true;
} catch (final HibernateException ex) {
LOGGER.warn(
"Hibernate exception was raised while trying to delete order, info: ",
ex.getLocalizedMessage());
"Hibernate exception was raised while trying to delete order, info: " +
ex.getLocalizedMessage(),ex);
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class Order {
@LazyCollection(LazyCollectionOption.FALSE)
private List<ProductHolder> orderList = new ArrayList<ProductHolder>();

@ManyToOne(targetEntity = Business.class, cascade = CascadeType.ALL)
@ManyToOne(targetEntity = Business.class)
@JoinColumn(name = "BUSINESS_ID")
private Business business;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.qorder.qorderws.service;

import com.qorder.qorderws.dto.order.PendingOrdersDTO;
import com.qorder.qorderws.dto.order.OrderDTO;
import com.qorder.qorderws.dto.order.PendingOrdersDTO;
import com.qorder.qorderws.exception.BusinessDoesNotExistException;

public interface IOrderService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import com.qorder.qorderws.dao.IBusinessDAO;
import com.qorder.qorderws.dao.IOrderDAO;
import com.qorder.qorderws.dto.order.PendingOrdersDTO;
import com.qorder.qorderws.dto.order.OrderDTO;
import com.qorder.qorderws.dto.order.OrderViewDTO;
import com.qorder.qorderws.dto.order.PendingOrdersDTO;
import com.qorder.qorderws.exception.BusinessDoesNotExistException;
import com.qorder.qorderws.mapper.OrderDTOtoOrderMapper;
import com.qorder.qorderws.mapper.OrderToOrderViewDTOMapper;
Expand Down Expand Up @@ -57,8 +57,8 @@ public PendingOrdersDTO fetchOrdersFromBusinessID(long businessId) throws Busine
{
OrderViewDTO orderView = new OrderToOrderViewDTOMapper().map(order, new OrderViewDTO());
businessOrders.addOrderViewDTO(orderView);
orderDAO.delete(order);
}
return businessOrders;
}

}
2 changes: 1 addition & 1 deletion QorderWS/src/main/resources/hibernate/hibernate.cfg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<property name="hbm2ddl.auto">validate</property>
<property name="hbm2ddl.auto">create</property>

<mapping class="com.qorder.qorderws.model.order.Order" />
<mapping class="com.qorder.qorderws.model.order.ProductHolder" />
Expand Down

0 comments on commit ffda46d

Please sign in to comment.