Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. @Repository
  2. public class ReadDaoImpl implements ReadDao{
  3.  
  4. private static SessionFactory sessionFactory;
  5.  
  6. public static SessionFactory getSessionFactory() {
  7. return sessionFactory;
  8. }
  9.  
  10. @Autowired
  11. public static void setSessionFactory(SessionFactory sessionFactory) {
  12. TenderReadDaoImpl.sessionFactory = sessionFactory;
  13. }
  14.  
  15. @Override
  16. public List<Read> getAllReads() {
  17.  
  18. System.out.println("DEBUG: Inside ReadDaoImpl.getAllReads");
  19.  
  20. Session session = sessionFactory.openSession(); // I think that the issue comes from here
  21. Transaction tx = null;
  22. ..............................
  23. ..............................
  24. }
  25. }
  26.  
  27. Session session = sessionFactory.openSession();
  28.  
  29. # ===============================
  30. # = DATA SOURCE
  31. # ===============================
  32.  
  33. # Set here configurations for the database connection
  34.  
  35. # Connection url for the database
  36. spring.datasource.url = jdbc:mysql://localhost:3306/readsdb?useSSL=false
  37.  
  38. # Username and password
  39. spring.datasource.username = root
  40. spring.datasource.password = password
  41.  
  42. # Keep the connection alive if idle for a long time (needed in production)
  43. spring.datasource.testWhileIdle = true
  44. spring.datasource.validationQuery = SELECT 1
  45.  
  46. # ===============================
  47. # = JPA / HIBERNATE
  48. # ===============================
  49.  
  50. # Use spring.jpa.properties.* for Hibernate native properties (the prefix is
  51. # stripped before adding them to the entity manager).
  52.  
  53. # Show or not log for each sql query
  54. spring.jpa.show-sql = true
  55.  
  56. # Hibernate ddl auto (create, create-drop, update): with "update" the database
  57. # schema will be automatically updated accordingly to java entities found in
  58. # the project
  59. spring.jpa.hibernate.ddl-auto = create-drop
  60.  
  61. # Naming strategy
  62. spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
  63.  
  64. # Allows Hibernate to generate SQL optimized for a particular DBMS
  65. spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement