spring-repositories

Multiple LDAP repositories with Spring LDAP Repository

自作多情 提交于 2019-12-03 20:47:12
I would like to set more than one LDAP repositories with Spring LDAP. My aim is to create or update objects in all repositories at the same time. I use LdapRepository Spring interface and I think that isn't possible for now. I wonder if I can create my own LdapRepository extending the Spring one but I have no idea how to start. This my configuration : @Configuration @EnableLdapRepositories("com.xxx.repository.ldap") @PropertySource("classpath:ldap.properties") public class LdapConfiguration { @Autowired Environment ldapProperties; @Bean public LdapContextSourceCustom contextSourceTarget() {

Spring data repository's method to find by the field of a field

那年仲夏 提交于 2019-12-03 09:16:48
问题 I've two entities, a user and a registered user. A registered user has a field of type user. I would like to have a method in the spring data repository related to this registered user entity to search all registered users by the username of the user that is connected to the registered user. So, this is the registered user entity with an associated user field: @Entity public class RegisteredUser implements Serializable { ... @OneToOne @JoinColumn(name = "USERNAME_FK") private User user; ... }

Spring data repository's method to find by the field of a field

試著忘記壹切 提交于 2019-12-03 00:49:28
I've two entities, a user and a registered user. A registered user has a field of type user. I would like to have a method in the spring data repository related to this registered user entity to search all registered users by the username of the user that is connected to the registered user. So, this is the registered user entity with an associated user field: @Entity public class RegisteredUser implements Serializable { ... @OneToOne @JoinColumn(name = "USERNAME_FK") private User user; ... } and this is a user with a username: @Entity public class User implements Serializable { ... @Id

Using Spring @Procedure to call StoredProcedure without binding to a table

会有一股神秘感。 提交于 2019-12-02 11:56:27
I would like to know if it is possible to call a stored procedure without having to bind it to a Table/Model? In my case I have a stored procedure in the database that sends a mail. I would like to call this from Spring: public interface SendEmail extends org.springframework.data.repository.Repository<Email, Long> { @Procedure(procedureName = "send_email") void sendEmail(String sender, String recipient, String ccRecipient, String subject, String message); } The above code compiles fine and runs fine - no problem. Only problem is that I would like to get rid of the extends Repository<Email,

Check date between two other dates spring data jpa

牧云@^-^@ 提交于 2019-11-27 11:56:00
问题 I have this model: public class Event { private String name; private Date start; private Date end; } and repository as @Repository public interface EventRepository extends JpaRepository<Event, Long> { List<Event> findByEventTypeAccount(Account account); } What I want to do is, I will pass one date and need to check that date is between start and end eg(i will pass sept 30 as date and need to find all entries which have sept 30 between their start and end ) Something like