This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| If you use the findAll(Specification, Pageable) method, a count query is first executed and then the | |
| data query is executed if the count returns a value greater than the offset. | |
| For what I was doing I did not need pageable, but simply wanted to limit my results. This is easy | |
| to do with static named queries and methodNameMagicGoodness queries, but from my research (googling | |
| for a few hours) I couldn't find a way to do it with dynamic criteria queries using Specifications. | |
| During my search I found two things that helped me to figure out how to just do it myself. | |
| 1.) A stackoverflow question. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################################################### | |
| # The MIT License | |
| # | |
| # Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>. | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is |