Skip to content

Instantly share code, notes, and snippets.

@wbruno
Created June 7, 2019 22:10
Show Gist options
  • Save wbruno/e09c0729d885988dbc055c52a84bdd99 to your computer and use it in GitHub Desktop.
Save wbruno/e09c0729d885988dbc055c52a84bdd99 to your computer and use it in GitHub Desktop.
StockRepository.groovy
@Repository
interface StockRepository extends JpaRepository<Stock, Long> {
@Query(value = 'SELECT DISTINCT s FROM Stock s LEFT JOIN FETCH s.warehouse LEFT JOIN FETCH s.commitments WHERE s.sku IN (?1) AND s.organizationId = ?2')
List<Stock> findAllBySkuInAndOrganizationId(Set<String> skus, Long organizationId)
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment