Rather than tying yourself to hibernate, your gallery component should accept a parameter of type AssetProvider (or similar name)
public interface AssetProvider { public List<Asset> getAssets(int startIndex, int maxResults); public int getAssetCount(); } I'd probably wrap the component in a zone and use eventlinks for forward and back which passed the page number in the event. public class Gallery { @Inject private Zone galleryZone; @Parameter(required=true) private int itemsPerPage; @Parameter(required=true) private AssetProvider assetProvider; @Property private int currentPage; public void onPageChange(int page) { this.currentPage = currentPage; return galleryZone.getBody(); } public List<Assets> getAssets() { int startIndex = itemsPerPage * currentPage; return assetProvider.getAssets(startIndex, itemsPerPage); } public boolean isShowNext() { // not tested ;) return assetProvider.getAssetCount() < (itemsPerPage * currentPage); } public boolean isShowPrev() { return currentPage > 0; } } <t:zone id="galleryZone"> <t:loop source="assets" value="asset"> <${asset}> </t:loop> <t:if test="showPrev"> <t:eventlink event="pageChange" zone="galleryZone" context="${currentPage - 1}">Prev</t:eventlink> </t:if> <t:if test="showNext"> <t:eventlink event="pageChange" zone="galleryZone" context="${currentPage + 1}">Next</t:eventlink> </t:if> </t:zone> -- View this message in context: http://tapestry.1045711.n5.nabble.com/Gallery-for-each-article-using-hibernate-tp5716817p5716837.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org