Support for DAO update notifications

481 views
Skip to first unread message

Dia Kharrat

unread,
Jun 30, 2012, 4:56:43 PM6/30/12
to ormlit...@googlegroups.com
I'm considering ORMLite for an Android app I'm developing, and was wondering if ORMLite has support for listeners on data updates, such that registered listeners of a DAO get notified when the underlying data changes. The UI can be a listener of this event and in turn update the view accordingly, without having to know who performed the update. This pattern really makes things modular and decreases coupling of different components of the app.

Are there any plans to provide built-in support for this pattern in ORMLite?

Thanks,
Dia

glenviewjeff

unread,
Jun 30, 2012, 10:46:30 PM6/30/12
to ormlit...@googlegroups.com
There's really no reason to build this into OrmLite.  It should be almost trivial for you or someone to implement this using a custom Dao that uses your favorite event tool (Guava's EventBus or RoboGuice's EventManager.) 

Jeff

Or Gilad

unread,
May 4, 2017, 2:55:04 PM5/4/17
to ORMLite Users
For all the lost sheep other there, consider this as a nice and elegant option: REALM 

Kevin Galligan

unread,
May 4, 2017, 3:04:01 PM5/4/17
to Ormlite User
Or use DaoObserver in ormlite, or any of the several other sqlite
orm's that support data update notifications. Or use one of the
several rxjava integrations.

http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/dao/Dao.DaoObserver.html
https://github.com/j256/ormlite-android/blob/master/src/main/java/com/j256/ormlite/android/apptools/BaseOrmLiteLoader.java#L87

Or use realm, I guess.
> --
> You received this message because you are subscribed to the Google Groups
> "ORMLite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ormlite-user...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Kevin Galligan
https://twitter.com/kpgalligan
Reply all
Reply to author
Forward
0 new messages