0

Is it possible, from an Android project using GreenDAO, to dynamically (at run-time) access database model structural information (entities, properties, Schema, ...) defined in the generator project?

My first impression is that it's not possible. If it is, how can I do that?

Thanks for your answer.

Esp
  • 1
  • 2

1 Answers1

1

you can do via reflection.

DaoMaster's parent, AbstractDaoMaster has a private field daoConfigMap which includes the configuration for tables.

not a proper way but possible if you are trying to hack sth.

Another approach, if you want to access properties on know dao's etc, each generated Dao class have a public static Properties class which defines the properties.

yigit
  • 37,683
  • 13
  • 72
  • 58
  • Thanks for the reply. Does `daoConfigMap` also includes configuration about relations? I suppose it does. It's for determining whether I could do some dynamic reconfiguration of the database model for one of my works. – Esp Aug 14 '13 at 01:01
  • @yigit, Do you think with this approach it's possible to make and use dynamic DAO objects (objects whose SQL layout is created at run time not at compile time)? – WindRider Jan 27 '16 at 16:05