I want execute drop
table query on my database using spring JPA (Database- Postgres
)
This is my code:
public void executeDropTable(String tableName){
String query = "DROP TABLE IF EXISTS :tableName";
entityManager.createQuery(query)
.setParameter("tableName", tableName)
.executeUpdate();
}
But in IntelliJ shows error as 'DROP' unexpected
on a query string