You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
I'm using AA with ORMLite on all my applications. I miss an annotation to declare an ORMLIte DAO in my activites / services / beans.
I would like to have something like that :
@EActivity(R.layout.main)
public class MyActivity extends Activity {
@OrmLiteDao(model = User.class, helper = DatabaseHelper.class)
protected UserDao userDao;
}
I'm already working on it but I'd like to have your thoughts on the issue or some advices if you have any.
Ok, interesting. One thing I don't get though : what is UserDao exactly ? How does DaoManager.createDao knows it should return a UserDao (You give it User.class, not UserDao.class)? I haven't used ORMLite so I'm probably missing something here.
UserDao is an interface extending the ORMLite Dao<T, ID> class which is created with the DaoManager.
If you want your own methods in your DAO, you have to extend the Dao created by ORMLite.
Activity
pyricau commentedon Jun 8, 2012
This is interesting. What would the generated code look like ?
johanpoirier commentedon Jun 8, 2012
Currently, it looks like this from a EBean annoted class :
pyricau commentedon Jun 8, 2012
Ok, interesting. One thing I don't get though : what is
UserDaoexactly ? How doesDaoManager.createDaoknows it should return aUserDao(You give itUser.class, notUserDao.class)? I haven't used ORMLite so I'm probably missing something here.johanpoirier commentedon Jun 8, 2012
UserDao is an interface extending the ORMLite Dao<T, ID> class which is created with the DaoManager.
If you want your own methods in your DAO, you have to extend the Dao created by ORMLite.
pyricau commentedon Jun 8, 2012
Ok, I got it, just had a look at [DaoManager.createDao()](http://ormlite.com/javadoc/ormlite-core/com/j256/ormlite/dao/DaoManager.html#createDao(com.j256.ormlite.support.ConnectionSource, java.lang.Class) and saw that it has a parameterized return type that extends Dao parameterized with the input class. This explains the uneeded cast.
I guess AA validator should check that UserDao extends Dao parameterized with User.
johanpoirier commentedon Jun 8, 2012
Yes indeed. I have some work to do on the validator.