I’ve read about AbstractRoutingDataSource and the standard ways to bind a datasource dynamically in this article: It uses a ThreadLocal context holder to “set” the DataSource: I have a quite complex system where threads are not necessarily in my control, say: Scheduled EJB reads a job list from the database For each Job it fires a Spring (or Java EE)
Tag: spring-data
Handle optional parameters in QueryDSL
I am using QueryDSL with SpringData. I have Table say, Employee and I have created entity class say, EmployeeEntity I have written following service method As in above I commented the NPException. How to use QueryDSL for optional Parameters in QueryDSL using Spring Data? Thank you 🙂 Answer BooleanBuilder can be used as a dynamic builder for boolean expressions:
What’s the difference between Spring Data’s MongoTemplate and MongoRepository?
I need to write an application with which I can do complex queries using spring-data and mongodb. I have been starting by using the MongoRepository but struggled with complex queries to find examples or to actually understand the Syntax. I’m talking about queries like this: or the use of JSON based queries which I tried by trial and error because
What is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?
What is the difference between CrudRepository and JpaRepository interfaces in Spring Data JPA? When I see the examples on the web, I see them there used kind of interchangeably. What is the difference between them? Why would you want to use one over the other? Answer JpaRepository extends PagingAndSortingRepository which in turn extends CrudRepository. Their main functions are: CrudRepository mainly
Spring-data-mongodb connect to multiple databases in one Mongo instance
I am using the latest spring-data-mongodb (1.1.0.M2) and the latest Mongo Driver (2.9.0-RC1). I have a situation where I have multiple clients connecting to my application and I want to give each one their own “schema/database” in the same Mongo server. This is not a very difficult task to achieve if I was using the driver directly: See, easy. But
spring-data-mongo – optional query parameters?
I am using spring-data mongo with the JSON based query methods, and am unsure how to allow optional parameters in a search query. For instance – say I had the following function -but I didnt want to apply the name regex match, or not apply a date range restriction if NULL values were passed to the method. At the moment