BradyNadeau / ionic-orm

Data-Mapper ORM for Ionic2, AngularJS, ( Hybrid Mobile Applications ), Supports WebSQL and SQLite databases. Currently in active development. - TypeORM Fork
https://typeorm.github.io
MIT License
48 stars 13 forks source link

Is there any way to clear entire data in specific entity and clearing data from multiple entities #20

Open akashbiz opened 5 years ago

akashbiz commented 5 years ago

I am trying to clear data from database table(entity). I tried using repository as well as entityManager for this but was unable to achieve this. Using Repository:

let repository = connection.getRepository(<entityName>);
repository.remove(<entityName>);

Error: Given object does not have a primary column, cannot transform it to database entity.

Using Entity Manager:

let manager = connection.createEntityManager();
manager.remove(<entityName>);

Error: RepositoryNotFoundError: No repository for "Function" was found. Looks like this entity is not registered in current "dbConnectionName" connection?

Any help?