Custom RuntimeExceptionDao implementation - best practice?

36 views
Skip to first unread message

Kay-Uwe Janssen

unread,
Nov 22, 2014, 1:36:08 PM11/22/14
to ormlite...@googlegroups.com
Hello there,

over at AndroidAnnotations (https://github.com/excilys/androidannotations) i opened a PR to inject custom implementations of RuntimeExceptionDao.

As the OrmLite project does not support direct creation of custom RuntimeExceptionDaos by itself using e.g. helper.getRuntimeExceptionDao() we implemented that feature in a similar way getRuntimeExceptionDao() works but with instantiating the custom class directly.

this is how the current generated code looks like.

try {
    runtimeExceptionDao = new RuntimeExceptionDao<Car, Long>((Dao<Car, Long>) databaseHelper_.getDao(Car.class));
} catch (SQLException e) {
    Log.e("OrmLiteActivity_", "Could not create DAO runtimeExceptionDao", e);
}
try {
    userRuntimeExceptionDao = new UserRuntimeExceptionDao((Dao<User, Long>) databaseHelper_.getDao(User.class));
} catch (SQLException e) {
    Log.e("OrmLiteActivity_", "Could not create DAO userRuntimeExceptionDao", e);
}

the question is now. is this a good practice? or do you suggest something else.


here you can see the PR with all related comments: https://github.com/excilys/androidannotations/pull/1252


Thanks! :)
Reply all
Reply to author
Forward
0 new messages