2014-11-25 5 views
0

Java 및 Spring Framework 및 최대 절전 모드로 작업하고 있습니다. 나는 ProductType를위한 인벤토리가 위치, 그리고 하나 Querys, 하나 일부 재고 물건을 얻기 위해 인터페이스를 썼다 :이 완벽하게 작동하고두 개의 매개 변수가있는 Java JPA 쿼리

public interface ProductInventory extends Inventory<InventoryItem> { 

     @Query("select i from InventoryItem i, ProductItem c where i.product = c and c.type = ?1") 
     List<InventoryItem> findByProductType(ProductItem.ProductItem type); 

     @Query("select i from InventoryItem i, ProductItem c where i.product = c and c.locationid = ?1") 
     List<InventoryItem> findByProductLocation(long locationid); 
    } 

,하지만 지금은을 선택하는 쿼리를 작성하려면 제품 유형 및 위치 :

 @Query("select i from InventoryItem i, ProductItem c where i.product = c and c.type = ?1 and c.locationid = ?1") 
    List<InventoryItem> findByProductStandortAndType(ProductItem.ProductItemType type, long locationid); 

그러나 이것은 작동하지 않습니다. 누구든지 나를 도울 수 있습니까? 고마워요

답변

2

그럼 왜 두 번째 매개 변수를 쿼리에 사용하지 않습니까? 첫 번째 매개 변수에 대해 "? 1"이 두 번 나타납니다.

+0

두 번째 매개 변수를 변경했습니다. – steke

관련 문제