Guest User

Untitled

a guest
Mar 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. entityManagerFactory = Persistence.createEntityManagerFactory("myPersistence-unit");
  2. EntityManager entityManager = openEntityManager( entityManagerFactory);
  3. entityManager.getTransaction().begin();
  4.  
  5. String queryDropCollection = "db.Person.drop()";
  6. String queryDropDB = "db.dropDatabase()";
  7.  
  8. entityManager.createNativeQuery(queryDropCollection).executeUpdate();
  9. entityManager.createNativeQuery(queryDropDB).executeUpdate();
  10.  
  11. entityManager.getTransaction().commit();
  12. entityManager.close();
  13.  
  14. Exception in thread "main" com.mongodb.util.JSONParseException:
  15. db.Person.drop()
  16. ^
  17.  
  18. Exception in thread "main" com.mongodb.util.JSONParseException:
  19. db.dropDatabase()
  20. ^
Add Comment
Please, Sign In to add comment