Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. spring.h2.console.enabled=true
  2. spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
  3. spring.datasource.driverClassName=org.h2.Driver
  4. spring.datasource.username=
  5. spring.datasource.password=
  6. spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
  7. spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
  8.  
  9. @Service
  10. public class MyService {
  11.  
  12. @Resource
  13. private MyRepository repository;
  14.  
  15. @PostConstruct
  16. public void init() {
  17. repository.save(new MyEntity(/* some data here */));
  18.  
  19. // DEBUGGER here! At this point localhost:8082 hasn't got any of my tables
  20.  
  21. repository.findAll(); // Not empty! It returns me my entites
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement