Skip to content

Instantly share code, notes, and snippets.

View josergdev's full-sized avatar

José Rodríguez josergdev

  • Autentia
  • Madrid
View GitHub Profile
@josergdev
josergdev / OutboxIntegrationApplication.java
Created January 8, 2025 21:56
Outbox with Spring Integration
package dev.joserg.outboxintegration;
import org.postgresql.jdbc.PgConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
@josergdev
josergdev / od-directlink.m
Created December 31, 2024 17:07
OneDrive Direct Download Link Power Query
@josergdev
josergdev / CriteriaBuilderTupleIn.java
Last active October 6, 2024 21:54
CriteriaBuilder extension fort tuples IN feature
package dev.joserg.jpa;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.Expression;
import jakarta.persistence.criteria.Predicate;
import lombok.extern.slf4j.Slf4j;
@josergdev
josergdev / SliceSpecificationExecutor.java
Last active November 25, 2024 11:57
JpaSpecificationExecutor extension to find All Slice by Specification
package dev.joserg.jpa;
import static org.springframework.data.domain.ScrollPosition.offset;
import java.util.function.Function;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.ScrollPosition;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.SliceImpl;
@josergdev
josergdev / SliceJpaRepositoryImpl.java
Last active August 24, 2024 12:00
SimpleJpaRepository extension to find All Slice by Specification
package dev.joserg.jpa;
import jakarta.persistence.EntityManager;
import org.jetbrains.annotations.Nullable;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.SliceImpl;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
@josergdev
josergdev / SimpleHttpCriteria.java
Last active August 24, 2024 10:51
This class maps http query parameters to the JPA specification with common convention behavior
package dev.joserg.jpa;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.CriteriaQuery;
import jakarta.persistence.criteria.JoinType;
@josergdev
josergdev / GenericSpecification.java
Last active August 24, 2024 12:03
Spring Data Specification to find data by pairs of attributes
package dev.joserg.util.jpa;
import static org.springframework.data.jpa.domain.Specification.allOf;
import static org.springframework.data.jpa.domain.Specification.anyOf;
import java.util.List;
import java.util.Optional;
import jakarta.annotation.Nonnull;
import jakarta.persistence.criteria.Root;