Advertisement
Guest User

Untitled

a guest
Jul 29th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. @EnableTransactionManagement
  2. @EnableScheduling
  3. @Configuration
  4. @EnableNeo4jRepositories(basePackages = "com.mycompany.analytics.graph.repository")
  5. public class Neo4jConfig extends Neo4jConfiguration {
  6.  
  7. public static final String URL = System.getenv("NEO4J_URL") != null ? System.getenv("NEO4J_URL") : "http://neo4j:movies@localhost:7474";
  8.  
  9. @Bean
  10. public org.neo4j.ogm.config.Configuration getConfiguration() {
  11. org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration();
  12. config
  13. .driverConfiguration()
  14. .setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver")
  15. .setURI(URL);
  16. return config;
  17. }
  18.  
  19. @Override
  20. public SessionFactory getSessionFactory() {
  21. return new SessionFactory(getConfiguration(), "com.mycompany.analytics.graph.repository");
  22. }
  23. }
  24.  
  25. /**
  26. * Spring Data JPA repository for the User entity.
  27. */
  28. public interface UserRepository extends JpaRepository<User, Long> {
  29. Optional<User> findOneByActivationKey(String activationKey);
  30. List<User> findAllByActivatedIsFalseAndCreatedDateBefore(ZonedDateTime dateTime);
  31.  
  32. Optional<User> findOneByResetKey(String resetKey);
  33.  
  34. Optional<User> findOneByEmail(String email);
  35.  
  36. Optional<User> findOneByLogin(String login);
  37.  
  38. Optional<User> findOneById(Long userId);
  39.  
  40. @Override
  41. void delete(User t);
  42. }
  43.  
  44. @Service
  45. @Transactional
  46. public class UserService {
  47. ....
  48.  
  49. @Inject
  50. private UserRepository userRepository;
  51. ....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement