No property found for type… custom Spring Data repository

The problem here is that you are creating FilterRepositoryImpl but you are using it in UserRepository. You need to create UserRepositoryImpl to make this work. Read this doc for more detail Basically public interface UserRepositoryCustom { List<User> filterBy(String role); } public class UserRepositoryImpl implements UserRepositoryCustom { … } public interface UserRepository extends JpaRepository<User, String>, UserRepositoryCustom … Read more

Why is data getting stored with weird keys in Redis when using Jedis with Spring Data?

Ok, googled around for a while and found help at http://java.dzone.com/articles/spring-data-redis. It happened because of Java serialization. The key serializer for redisTemplate needs to be configured to StringRedisSerializer i.e. like this: <bean id=”jedisConnectionFactory” class=”org.springframework.data.redis.connection.jedis.JedisConnectionFactory” p:host-name=”${redis.server}” p:port=”${redis.port}” p:use-pool=”true”/> <bean id=”stringRedisSerializer” class=”org.springframework.data.redis.serializer.StringRedisSerializer”/> <bean id=”redisTemplate” class=”org.springframework.data.redis.core.RedisTemplate” p:connection-factory-ref=”jedisConnectionFactory” p:keySerializer-ref=”stringRedisSerializer” p:hashKeySerializer-ref=”stringRedisSerializer” /> Now the key in redis is vc:501381. Or … Read more

How to beautifully update a JPA entity in Spring Data?

Even better then @Tanjim Rahman answer you can using Spring Data JPA use the method T getOne(ID id) Customer customerToUpdate = customerRepository.getOne(id); customerToUpdate.setName(customerDto.getName); customerRepository.save(customerToUpdate); Is’s better because getOne(ID id) gets you only a reference (proxy) object and does not fetch it from the DB. On this reference you can set what you want and on … Read more

Filtering database rows with spring-data-jpa and spring-mvc

For starters you should stop using @RequestParam and put all your search fields in an object (maybe reuse the Travel object for that). Then you have 2 options which you could use to dynamically build a query Use the JpaSpecificationExecutor and write a Specification Use the QueryDslPredicateExecutor and use QueryDSL to write a predicate. Using … Read more