@SqlUpdate @Audited(ChangeType.UPDATE) public void updateBundleLastSysTime(@Bind("id") String id, @Bind("lastSysUpdateDate") Date lastSysUpdate, @SmartBindBean final InternalCallContext context);
@Mapper(MessageMapper.class) @SqlQuery("DELETE FROM messages WHERE " + ID + " IN (SELECT " + ID + " FROM messages WHERE " + DESTINATION + " = :destination AND " + DESTINATION_DEVICE + " = :destination_device AND " + SOURCE + " = :source AND " + TIMESTAMP + " = :timestamp ORDER BY " + ID + " LIMIT 1) RETURNING *") abstract OutgoingMessageEntity remove(@Bind("destination") String destination, @Bind("destination_device") long destinationDevice, @Bind("source") String source, @Bind("timestamp") long timestamp);
@SqlQuery public CatalogOverrideBlockDefinitionModelDao getByAttributes(@Bind("parentUnitName") final String parentUnitName, @Bind("currency") final String currency, @Bind("price") final BigDecimal price, @Bind("max") final double max, @Bind("size") final double size, @SmartBindBean final InternalTenantContext context);
@SqlQuery @SmartFetchSize(shouldStream = true) public Iterator<M> search(@Bind("searchKey") final String searchKey, @Bind("likeSearchKey") final String likeSearchKey, @Bind("offset") final Long offset, @Bind("rowCount") final Long rowCount, @Define("ordering") final String ordering, @SmartBindBean final InternalTenantContext context);
private List<String> retrieveEntityIdsFromArguments(final Method method, final Object[] args) { final Annotation[][] parameterAnnotations = getAnnotations(method); int i = -1; for (final Object arg : args) { i++; // Assume the first argument of type Entity is our type of Entity (type U here) // This is true for e.g. create calls if (arg instanceof Entity) { return ImmutableList.<String>of(((Entity) arg).getId().toString()); } // For Batch calls, the first argument will be of type List<Entity> if (arg instanceof Iterable) { final Builder<String> entityIds = extractEntityIdsFromBatchArgument((Iterable) arg); if (entityIds != null) { return entityIds.build(); } } for (final Annotation annotation : parameterAnnotations[i]) { if (arg instanceof String && Bind.class.equals(annotation.annotationType()) && ("id").equals(((Bind) annotation).value())) { return ImmutableList.<String>of((String) arg); } else if (arg instanceof Collection && BindIn.class.equals(annotation.annotationType()) && ("ids").equals(((BindIn) annotation).value())) { return ImmutableList.<String>copyOf((Collection) arg); } } } return ImmutableList.<String>of(); }
public Binder build(Annotation annotation) { Bind bind = (Bind) annotation; try { return bind.binder().newInstance(); } catch (Exception e) { throw new IllegalStateException("unable to instantiate specified binder", e); } } }
@Mapper(MessageMapper.class) @SqlQuery("SELECT * FROM messages WHERE " + DESTINATION + " = :destination AND " + DESTINATION_DEVICE + " = :destination_device ORDER BY " + TIMESTAMP + " ASC LIMIT " + RESULT_SET_CHUNK_SIZE) abstract List<OutgoingMessageEntity> load(@Bind("destination") String destination, @Bind("destination_device") long destinationDevice);
@SqlQuery public List<CatalogOverridePhaseDefinitionModelDao> getByAttributes(@Bind("parentPhaseName") String parentPhaseName, @Bind("currency") String currency, @Bind("fixedPrice") BigDecimal fixedPrice, @Bind("recurringPrice") BigDecimal recurringPrice, @SmartBindBean final InternalTenantContext context);
@SqlQuery public List<EntityHistoryModelDao<M, E>> getHistoryForTargetRecordId(@Define("bypassMappingRegistryCache") final boolean bypassMappingRegistryCache, @Bind("targetRecordId") final long targetRecordId, @SmartBindBean InternalTenantContext context); @SqlUpdate
@Override public void bind(SQLStatement q, Bind b, Object arg) { q.bind(b.value(), arg); }
@Override public Binder build(Annotation annotation) { Bind bind = (Bind) annotation; try { return bind.binder().newInstance(); } catch (Exception e) { throw new IllegalStateException("unable to instantiate specified binder", e); } } }
@SqlUpdate @Audited(ChangeType.UPDATE) public Object updatePaymentMethod(@Bind("id") String accountId, @Bind("paymentMethodId") String paymentMethodId, @SmartBindBean final InternalCallContext context);