-3

I have just been doing a quick crash course in greenDAO because I have taken over development of an app that is heavily dependent on greenDAO . Basically I need to add an extra table and I figured I cant add another table to a DAO class that already has another table defined in it , so I would like to know how I can add another DAO class so that I may be able to add the other table

Zidane
  • 1,696
  • 3
  • 21
  • 35
  • What exactly is the problem code? I had no problems adding tables with greenDao the way desribed in docs. – Serg Jun 22 '16 at 10:02
  • @Serg for example if I have carDAO which defines a car table , bicycleDAO which defines a bicycle table . How then do I add a busDao for me to be able to define my bus table – Zidane Jun 22 '16 at 10:07
  • http://greenrobot.org/greendao/documentation/modelling-entities/ You need to modify and run generator programm to get updated set of xxDAO classes sources to be used on Android project. – Serg Jun 22 '16 at 10:15
  • I been looking at that link and and I cant quite locate the part where they talk about adding a new Entity /DAO class , please note I am not talking about first time generation but to add Entity in a situation where there are already other entities which were previously generated in the project – Zidane Jun 22 '16 at 11:17

1 Answers1

1

See http://greenrobot.org/greendao/documentation/modelling-entities and http://greenrobot.org/greendao/documentation/how-to-get-started/

You need to find generator in your sources which looks like https://github.com/greenrobot/greenDAO/blob/master/DaoExampleGenerator/src/de/greenrobot/daogenerator/gentest/ExampleDaoGenerator.java. Modify, compile and run the generator, pointing directory containing existing xxxDAO.java files as an output dir. Generator will update existing files preserving your custom methods in xxxDAO.java file (if they are placed properly between special comments, see docs). And new xxxDAO files will be added.

Serg
  • 22,285
  • 5
  • 21
  • 48
  • very helpful thank you I now understand what is going on. I am now trying to figure out how to run the generator script that was handed to me by the previous developer without without overwriting the existing structure . – Zidane Jun 22 '16 at 13:19