by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 07:23

    sothawo on 3.2.x

    DATAES-937 - Repository queries… (compare)

  • 06:18
    christophstrobl closed #459
  • 06:18

    christophstrobl on DATACMNS-1762

    (compare)

  • 06:17

    christophstrobl on master

    DATACMNS-1762 - Remove Reactive… DATACMNS-1762 - Extract Nullabl… DATACMNS-1762 - Support Optiona… and 2 more (compare)

  • Sep 24 22:53
    jxblum synchronize #467
  • Sep 24 22:51
    jxblum edited #467
  • Sep 24 22:51
    jxblum edited #467
  • Sep 24 22:49
    jxblum synchronize #467
  • Sep 24 20:51
    jxblum edited #467
  • Sep 24 20:51
    jxblum edited #467
  • Sep 24 20:51
    jxblum edited #467
  • Sep 24 20:51
    jxblum edited #467
  • Sep 24 20:51
    jxblum opened #467
  • Sep 24 20:37

    sothawo on 4.0.x

    DATAES-937 - Repository queries… (compare)

  • Sep 24 20:14

    sothawo on master

    DATAES-937 - Repository queries… (compare)

  • Sep 24 20:14
    sothawo closed #525
  • Sep 24 20:13
    sothawo opened #525
  • Sep 24 19:19

    sothawo on 3.2.x

    DATAES-896 - Use mainField pro… (compare)

  • Sep 24 19:19
    sothawo closed #524
  • Sep 24 19:18
    sothawo opened #524
Peter-Josef Meisch
@sothawo
Instant is a TemporalAccessor defining a point in time. Duration is just a numeric value.
You should be able to provide the CustomConversions as a bean, but I have to check for details and won't have time until this evening for that.
Shantanu Singh Rautela
@Shantanu28

Hi Team,

Need small help

@RefreshScope
@Configuration
@EnableR2dbcRepositories(basePackages = "com.paymentservice.repository", databaseClientRef = "databaseClient")
public class PaymentR2dbcConfiguration extends AbstractR2dbcConfiguration {

    @Value("${payment.data.mssql.host}")
    private String host;

    @Value("${payment.data.mssql.port}")
    private int port;

    @Value("${payment.data.mssql.database}")
    private String database;

    @Value("${payment.data.mssql.username}")
    private String username;

    @Value("${payment.data.mssql.password}")
    private String password;

    /**
     * An implementation of {@link ConnectionFactory} for creating connections to
     * a Microsoft SQL Server database using R2DBC.
     *
     * @return A factory for creating {@link Connection}s.
     */
    @Override
    public ConnectionFactory connectionFactory() {
        return new MssqlConnectionFactory(
            MssqlConnectionConfiguration.builder()
                .host(host)
                .port(port)
                .database(database)
                .username(username)
                .password(password).build());
    }
}

I m getting

The bean 'r2dbcDatabaseClient', defined in class path resource [org/springframework/boot/autoconfigure/data/r2dbc/R2dbcDataAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [com/paymentservice/configurations/PaymentR2dbcConfiguration.class] and overriding is disabled.

I m using

       <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-r2dbc</artifactId>
            <version>1.1.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>io.r2dbc</groupId>
            <artifactId>r2dbc-mssql</artifactId>
            <version>0.8.4.RELEASE</version>
        </dependency>
2 replies
peterchenadded
@peterchenadded
@sothawo yeah seems just creating the elasticsearchCustomConversions() bean is not sufficient.
peterchenadded
@peterchenadded
@sothawo got it working all good it seems.
2 replies
Martin Payne
@MP7373

I noticed in the spring data rest docs it shows:
@RepositoryRestResource(path = "path", rel= "rel")

but I had to use:
@RepositoryRestResource(path = "path", collectionResourceRel = "rel")

Is rel from an older version and was it replaced by collectionResourceRel, does rel still exist and is different from collectionResourceRel, or is it a mistake in the documentation?

I don't know if I should submit an issue or what about documentation because I couldn't find a git repo for those docs, instead there was a link to this gitter group so I'm just asking this here.

Pavan K Jadda
@pavankjadda
I am trying to use concat on on spring data JPA, I am getting The data types varchar and varbinary are incompatible in the add operator. error
@Query("SELECT a from ApiEnrollmentsView a where (:mrn is null or a.mrn=:mrn) and " +
        " (:firstName is null  or UPPER(a.firstName) like UPPER(concat(:firstName, '%'))) and " +
        " (:lastName is null  or UPPER(a.lastName) like UPPER(concat(:lastName, '%'))) ")
List<ApiEnrollmentsView> findEnrollmentsByMrnAndFirstNameAndLastName(String mrn, String firstName, String lastName);
peterchenadded
@peterchenadded
Interesting springdata elastic search issue, @Query
Stream<Trace> findFutureDatedTraces(Instant futureDatedTime);, getting cannot cast Trace to Stream, when changing Stream to List it seems to work fine, anyone experienced this before?
7 replies
Nuno Marujo
@nhmarujo

Hi guys. I would like to know if there are any plans for providing out-of-the-box metrics for Spring Data. What I had in mind was a Timer with the following tags:

  • type - repository type (MongoRepository, JpaRepository, ….)
  • repository - name of the repository class
  • method - name of the method class

This would allow to easily have execution times (and counts) for all the queries. And since Spring Data provides such a nice abstraction, I think it would fit really nicely in it and would provide automatically metrics for a bunch of different datasources.

I did implement a simple Aspect to perform such task, but I think this is something that could come already with the framework (probably not done with an aspect and with exposed properties that would allow to control it).

This is my code: https://gist.github.com/nhmarujo/9383ff12c00fc27d0c8703f31b326798

Please let me know what you guys think and also if it is worth raising a request for it. Thanks :)

Mark Paluch
@mp911de
@nhmarujo we're investigating in that direction and have exposed a first API to collect metrics. For repository methods metrics you need a bit more than just intercepting the call. Repositories may make use of reactive types, Kotlin Coroutines, Futures, Streams. We need to cater for these cases. Check out https://github.com/spring-projects/spring-data-commons/pull/455/files that provides an SPI through RepositoryMethodInvocationListener
Feel free to leave your thoughts on the mentioned pull request.
Nuno Marujo
@nhmarujo
Thanks @mp911de . Yes, I do realise my approach is a bit simplistic in the sense that it doesn’t cover all the cases
Thanks for the share, will definitely take a look :)
Dirk Luijk
@dirkluijk

Hi all,

I am trying to implement a custom DataAccessStrategy for Spring Data JDBC, but I want to reuse SqlGenerator. However, it is package-private, including all its methods. Is this on purpose? Or can I submit a PR?

What I am trying to achieve: I want a custom base repository which supports fun findAll(specification: Specifications) (inspired by JPA). I already figured out how to register my custom base repository using a custom JdbcRepositoryFactory, JdbcRepositoryFactoryBean and JdbcAggregateTemplate (it was a bit tedious and involves a lot of copying). I am almost there, for the custom DataAccessStrategy I want to be able to find by SQL Condition objects.
Mark Paluch
@mp911de
Can you file a ticket @dirkluijk? We assumed that SqlGenerator won't be reused externally and that is why it's package private. Spring Data JDBC has already a query/criteria API. It would make sense to leverage this kind of functionality and circle specifications-like functionality back into Spring Data JDBC.
Dirk Luijk
@dirkluijk
How do I use it? It seems not to be documented (or I am looking for something else)?
Dirk Luijk
@dirkluijk
As far as I know it's only in Spring Data JPA.
Mark Paluch
@mp911de
We felt that query construction requires a bit more polishing before we can expose it as public API since row mappers expect certain columns/column aliases for result mapping and right now, query creation isn't yet where it should be.
Dirk Luijk
@dirkluijk
Ah right, so I can't work with it you say. I was already using Conditions but I can't use JdbcQueryCreator either.
What is your advice regarding complex (criteria-like) queries? Throw in another library?
Knut Schleßelmann
@kschlesselmann
Can I somehow use the result of ReactiveAuditingEntityCallback to populate Created/LastModifiedBy in my own callback or how would I find out if the entity is new?
8 replies
Dirk Luijk
@dirkluijk
I implemented a simple Specification API for JDBC for our project. I put the code in a Gist: https://gist.github.com/dirkluijk/1004c178922646dc297c862608c39c48. Might be interesting.
I was not able to implement it in a DataAccessStrategy, so I took some shortcuts (which are fine for us)
Registering a custom RepositoryFactory was a bit tedious, might be cool if that's more easier in the future.

It's based on this interface:

interface SpecificationRepository<T> {
    fun findAll(specification: Specification): Iterable<T>
    fun findAll(specification: Specification, sort: Sort): Iterable<T>
    fun findAll(specification: Specification, pageable: Pageable): Page<T>
}

(I use Kotlin by the way)

rajkcv
@rajkcv
While creating Repostories, why an interface is used instead of classes
image.png
Can anyone please let me know?
drykod
@drykod_twitter
Does the RedisHealthIndicator actually act as a sort of keep alive on a Redis cluster? (if let's say calling the health check / readiness every 10 seconds). From what I think so far, it does not. I always reach the Redis servers timeout (5 minutes) and it always reconnect every node...
drykod
@drykod_twitter
(seems to only run a cluster slots)
SauriBabu
@SauriBabu
Hi, is it possible to use multiple schema name in single sql query in spring boot application?
I know multiple DataSource could be created.. but here my need is different from that
James Howe
@OrangeDog
@Table has a schema attribute, if that's what you mean.
James Howe
@OrangeDog
Hibernate: if you get a QuerySyntaxException on a ( does that mean the dialect isn't aware of the function?
James Howe
@OrangeDog
Maybe I'm doing it wrong, but registering the function in a custom dialect doesn't appear to have solved it
James Howe
@OrangeDog
Found the answer. You have to add = 1 or = true- https://stackoverflow.com/a/12976962/476716
Matt Henry
@matthenry87
Hey all. I'm trying to create an aggregation that uses the Atlas Search's '$search' pipeline stage. This is different from the normal text search, and is something offered via the managed Atlas MongoDB product. Is there any support for this?
I've tried to leverage mongoTemplate.getCollection().aggregate (), passing in an array of Document objects, but then I run into Codec issues when it tries to convert to my specified POJO :/
Matt Henry
@matthenry87
Solved it for now using an anonymous class, implementing the toDocument() on AggregationOperation and piecing together the $search pipeline operation.
Jonathan Kolberg
@j.kolberg_gitlab
Hi all. I'm having a problem with cors in spring data rest. I have a RepositoryInferface with CrossOrigin annotation and Cors prevents the browser javascript from doing a put to create an association for a OneToOne relationship
Cedrick Lunven
@clun

[SpringDATACassandra] is this a known issue that you cannot use nested Collections ? Is there a workaround ?

Table

create table refdata_mapping(
  source        text,
  destination   text,
  field_mapping map<text,text>,
  audit         list<frozen<map<text,text>>>,
  PRIMARY KEY ((source), destination)
)

Entity

@Table(value="refdata_mapping")
public class RefDataMapping {
    @PrimaryKeyColumn(value="source",ordinal=0,type= PrimaryKeyType.PARTITIONED)
    private String source;

    @PrimaryKeyColumn(value="destination",ordinal=1,type= PrimaryKeyType.CLUSTERED)
    private String destination;

    @Column(value="field_mapping")
    private Map<String,String> fieldMapping;

    @Frozen
    @Column(value="audit")
    private List<Map<String,String >> audit;

Error on findbyId => codec not found for requested operation [map<varchar,varchar> <-> java.util.Map]

Mark Paluch
@mp911de
@clun sounds like a bug. Can you file a ticket at https://jira.spring.io along with a minimal reproducer?
Cedrick Lunven
@clun
Thank you @mp911de . Will do
Fly-Away
@Fly-Away
Hi is spring data envers support auditing along with mongodbrepository? I usually use it in JpaRepository with postgres db only
Mark Paluch
@mp911de
Envers is an Add-on to Hibernate. MongoDB isn't affiliated with Hibernate at all
Rohan Kumar
@rohanKanojia
Hi guys, I'm trying to access couchbase db running in kubernetes from spring