Advertisement
Guest User

Untitled

a guest
Mar 1st, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. # EMBEDDED SERVER CONFIGURATION
  2. server.contextPath=/api
  3.  
  4. # JPA
  5. spring.datasource.platform=org.hibernate.dialect.PostgreSQLDialect
  6. spring.jpa.show-sql=true
  7. spring.jpa.hibernate.ddl-auto=update
  8. spring.database.driverClassName=org.postgresql.Driver
  9. spring.datasource.url=jdbc:postgresql://localhost:5432/test
  10. spring.datasource.username=postgres
  11. spring.datasource.password=root
  12.  
  13. public class Application {
  14. public static final String DB_NAME = "TestDB";
  15. public static final String COMPTE_COLLECTION = "Compte";
  16. public static final String MONGO_HOST = "localhost";
  17. public static final int MONGO_PORT = 27017;
  18.  
  19. public static void main(String[] args) throws UnknownHostException {
  20.  
  21. try {
  22. MongoClient mongo = new MongoClient(MONGO_HOST, MONGO_PORT);
  23. MongoOperations mongoOps = new MongoTemplate(mongo, DB_NAME);
  24. Compte p = new Compte("jon", "jon");
  25. mongoOps.insert(p, COMPTE_COLLECTION);
  26.  
  27. System.out.println(p1);
  28.  
  29. mongo.close();
  30.  
  31. } catch (UnknownHostException e) {
  32. e.printStackTrace();
  33. }
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement