DBFlow icon indicating copy to clipboard operation
DBFlow copied to clipboard

JSONModel throws InvalidDBconfiguration: JSONModel is not registered with a Database

Open arturonaredo opened this issue 11 years ago • 3 comments

As you replied in stackoverflow JSONModel are mirrors to actual Tables and they don't have table() method. So, this error is thrown:

Process: com.glownet.app.staging.debug, PID: 19083
java.lang.RuntimeException: com.raizlabs.android.dbflow.structure.InvalidDBConfiguration: Table: com.raizlabs.android.dbflow.structure.container.JSONModel is not registered with a Database. Did you forget the @Table annotation?
        at com.raizlabs.android.dbflow.runtime.DBTransactionQueue.run(DBTransactionQueue.java:77)
 Caused by: com.raizlabs.android.dbflow.structure.InvalidDBConfiguration: Table: com.raizlabs.android.dbflow.structure.container.JSONModel is not registered with a Database. Did you forget the @Table annotation?
        at com.raizlabs.android.dbflow.config.FlowManager.getDatabaseForTable(FlowManager.java:63)
        at com.raizlabs.android.dbflow.runtime.transaction.process.ProcessModelHelper.process(ProcessModelHelper.java:26)
        at com.raizlabs.android.dbflow.runtime.transaction.process.ProcessModelTransaction.onExecute(ProcessModelTransaction.java:34)
        at com.raizlabs.android.dbflow.runtime.transaction.process.ProcessModelTransaction.onExecute(ProcessModelTransaction.java:12)
        at com.raizlabs.android.dbflow.runtime.DBTransactionQueue.run(DBTransactionQueue.java:63)

Following your suggestion I've created this bug. A detailed explanation can be found in: http://stackoverflow.com/questions/28561361/dbflow-using-jsonmodel-throws-invaliddbconfiguration-jsonmodel-is-not-registere

arturonaredo avatar Feb 20 '15 12:02 arturonaredo

thanks I usually check this pretty often, so it will remind me to get this done.

agrosner avatar Feb 20 '15 14:02 agrosner

I still cannot reach the table method TransactionManager.getInstance().addTransaction(new ProcessModelTransaction<>(ProcessModelInfo.withModels(admissionEntitlementJSONModel).table(AdmissionEntitlement.class)));

And if I remove it, ProcessModelTransaction is abstract and wants to implement the process model methods. Could you please provide an example? Maybe adding it to the example app...

arturonaredo avatar Feb 27 '15 23:02 arturonaredo

I was having the same issue. Turns out I had forgotten to add FlowManager.init(this) in the Application class. Now everything works fine. Even with instant run enabled and without adding any pro guard rules.

work-yuyu avatar Apr 10 '16 13:04 work-yuyu