5

How to print query in Room ? Not the query written in dao but the query generated by room itself.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Sujin Shrestha
  • 1,203
  • 2
  • 13
  • 23

1 Answers1

5

For every DAO class you add to your project marked with @Dao Room generate a class that implement your class. Hence for operations like Insert, Update and Delete that you don't provide any query Room will create a query itself. You can see this generated classes in the following file inside your project:

{root project}/app/build/generated/source/apt

, now navigate to the package that contains DAO classes and you will see classes like IssueDao_Impl.java. Inside this class you will see queries like this:

"INSERT OR REPLACE INTO `Issue`(`id`,`displayOrder`,`pdf`,`date`,`purchasable`,`source_id`,`thumb`,`full`,`mobile`,`width`,`height`,`download_count`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";

, created with the help of the annotations you did inside your class. Cheers!

Keivan Esbati
  • 3,376
  • 1
  • 22
  • 36