@SqlBatch("insert into repositories " + "(id, owner_id, name, full_name, description, fork, homepage, stargazers_count, language, created_at, updated_at, fetched_at) " + "values (:id, :ownerId, :name, :fullName, :description, :fork, :homepage, :stargazersCount, :language, current_timestamp(), current_timestamp(), current_timestamp()) " + "on duplicate key update " + "owner_id=values(owner_id), name=values(name), full_name=values(full_name), description=values(description), homepage=values(homepage), stargazers_count=values(stargazers_count), language=values(language), updated_at=values(updated_at), fetched_at=values(fetched_at)") @BatchChunkSize(100) void bulkInsert(@BindBean List<Repository> repos);
@SqlBatch("insert into users (id, type, login, avatar_url, created_at, updated_at) " + "values (:id, :type, :login, :avatarUrl, current_timestamp(), current_timestamp()) " + "on duplicate key update login=values(login), avatar_url=values(avatar_url), updated_at=values(updated_at)") @BatchChunkSize(100) void bulkInsert(@BindBean List<User> users);
@SqlBatch("insert into user_ranks (stargazers_count, rank, created_at, updated_at) " + "values (:stargazersCount, :rank, current_timestamp(), current_timestamp())") @BatchChunkSize(5000) void bulkInsert(@BindBean List<UserRank> userRanks); }
@SqlBatch("insert into repository_ranks (stargazers_count, rank, created_at, updated_at) " + "values (:stargazersCount, :rank, current_timestamp(), current_timestamp())") @BatchChunkSize(5000) void bulkInsert(@BindBean List<RepositoryRank> repoRanks); }
@SqlUpdate ( "UPDATE addon " + "SET value = CAST (:addon.value AS json), " + " model = CAST (:addon.model AS json) " + "WHERE entity_id = :entity.id " + "AND source = :addon.source " + "AND addon_group = :addon.group " ) void updateAddonGroup(@BindBean("entity") T entity, @BindAddonGroup("addon") AddonGroup addon);
@SqlQuery // Magic value to force MySQL to stream from the database // See http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html (ResultSet) @FetchSize(Integer.MIN_VALUE) public Iterator<M> getAll(@BindBean final InternalTenantContext context);
@SqlUpdate ( "INSERT INTO entity (id, slug, type) VALUES (:entity.id, :entity.slug, :type)" ) Integer createEntity(@BindBean("entity") Entity entity, @Bind("type") String type);
@SqlBatch("insert into organization_ranks (stargazers_count, rank, created_at, updated_at) " + "values (:stargazersCount, :rank, current_timestamp(), current_timestamp())") @BatchChunkSize(5000) void bulkInsert(@BindBean List<OrganizationRank> orgRanks); }
@SqlUpdate @Audited(ChangeType.DELETE) public void markTenantKeyAsDeleted(@Bind("id")final String id, @BindBean final InternalCallContext context); }
@SqlUpdate ( "INSERT INTO entity (id, slug, type, tenant_id) SELECT :entity.id, :entity.slug, :type, :tenantId " + "WHERE NOT EXISTS (SELECT 1 FROM entity where slug = :entity.slug AND type = :type AND tenant_id IS NOT DISTINCT FROM :tenantId)" ) Integer createEntityIfItDoesNotExist(@BindBean("entity") Entity entity, @Bind("type") String type, @Bind("tenantId") UUID tenantId);
@SqlQuery ( "SELECT id FROM entity WHERE slug = :entity.slug AND type = :type AND tenant_id IS NOT DISTINCT FROM :tenantId" ) UUID getId(@BindBean("entity") Entity entity, @Bind("type") String type, @Bind("tenantId") UUID tenantId);
@SqlQuery public abstract BlockingStateModelDao getBlockingStateForService(@Bind("blockableId") UUID blockableId, @Bind("service") String serviceName, @Bind("effectiveDate") Date effectiveDate, @BindBean final InternalTenantContext context);
@SqlQuery // Magic value to force MySQL to stream from the database // See http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html (ResultSet) @FetchSize(Integer.MIN_VALUE) public Iterator<PaymentModelDao> getByPluginName(@Bind("pluginName") final String pluginName, @Bind("offset") final Long offset, @Bind("rowCount") final Long rowCount, @BindBean final InternalTenantContext context); }
@SqlQuery // Magic value to force MySQL to stream from the database // See http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html (ResultSet) @FetchSize(Integer.MIN_VALUE) public Iterator<InvoiceModelDao> searchInvoices(@Bind("searchKey") final String searchKey, @Bind("offset") final Long offset, @Bind("rowCount") final Long rowCount, @BindBean final InternalTenantContext context);
@SqlQuery // Magic value to force MySQL to stream from the database // See http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html (ResultSet) @FetchSize(Integer.MIN_VALUE) public Iterator<PaymentMethodModelDao> getByPluginName(@Bind("pluginName") final String pluginName, @Bind("offset") final Long offset, @Bind("rowCount") final Long rowCount, @BindBean final InternalTenantContext context); }
@SqlQuery // Magic value to force MySQL to stream from the database // See http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html (ResultSet) @FetchSize(Integer.MIN_VALUE) public Iterator<TagModelDao> searchTags(@Bind("searchKey") final String searchKey, @Bind("likeSearchKey") final String likeSearchKey, @Bind("offset") final Long offset, @Bind("rowCount") final Long rowCount, @BindBean final InternalTenantContext context); }
@SqlUpdate @Audited(ChangeType.UPDATE) void updatePaymentForNewAttempt(@Bind("id") final String paymentId, @Bind("paymentMethodId") final String paymentMethodId, @Bind("amount") final BigDecimal amount, @Bind("effectiveDate") final Date effectiveDate, @BindBean final InternalCallContext context);
@SqlQuery // Magic value to force MySQL to stream from the database // See http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html (ResultSet) @FetchSize(Integer.MIN_VALUE) public Iterator<CustomFieldModelDao> searchCustomFields(@Bind("searchKey") final String searchKey, @Bind("likeSearchKey") final String likeSearchKey, @Bind("offset") final Long offset, @Bind("rowCount") final Long rowCount, @BindBean final InternalTenantContext context); }
@SqlUpdate @Audited(ChangeType.UPDATE) void updateStatus(@Bind("id") final String refundId, @Bind("refundStatus") final String status, @Bind("processedAmount") final BigDecimal processedAmount, @Bind("processedCurrency") final Currency processedCurrency, @BindBean final InternalCallContext context);
@SqlUpdate @Audited(ChangeType.UPDATE) void updatePaymentAttemptStatus(@Bind("id") final String attemptId, @Bind("processingStatus") final String processingStatus, @Bind("gatewayErrorCode") final String gatewayErrorCode, @Bind("gatewayErrorMsg") final String gatewayErrorMsg, @BindBean final InternalCallContext context);