I'm working with Java and the Spring Framework, and with hibernate. I wrote an Interface to get some inventory stuff by Querys, one for a Location, where the Inventory is and one for a ProductType:
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);
}
this is working perfect, but now i want to write an Query which selects the ProductType and the location:
@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);
but this isn't working. Maybe anyone can help me? Thanks a lot