0

I am using jenkins to build an Android library project that uses ORMLite and i am getting the following error which i really don't know how to solve :

[javac] /Users/x/Desktop/workspace/x/src/com/x/x/database/DatabaseHelper.java:109:
    type parameters of <D>D cannot be determined; no unique maximal instance exists
    for type variable D with upper bounds com.x.x.database.dao.DatabaseObjectDao,
    com.j256.ormlite.dao.Dao<com.x.x.database.entity.UserEntity,?>
[javac] sUserEntityDao = getDao(UserEntity.class);

Any help would be really great :)

Gray
  • 115,027
  • 24
  • 293
  • 354
LiohAu
  • 611
  • 12
  • 36
  • possible duplicate of [Why does the compiler state no unique maximal instance exists?](http://stackoverflow.com/questions/5666027/why-does-the-compiler-state-no-unique-maximal-instance-exists) – Gray Aug 06 '13 at 14:14

1 Answers1

0

So the below is probably wrong but I'll leave it for posterity. I initially thought this was an ORMLite error but now I think it is a compiler error.

I think you should look at this question/answer:

Why does the compiler state no unique maximal instance exists?


This may be an ORMLite error if part of the exception tree may have have some message to the effect of:

Could not find OpenHelperClass because none of the generic parameters of class 
YourActivityClass extends OrmLiteSqliteOpenHelper.  You should use
getHelper(Context, Class) instead.

The simple ORMLite pattern for Android applications is to have activity extend OrmLiteBaseActivity<YourDatabaseHelper>. Something like:

public class HelloAndroid extends OrmLiteBaseActivity<DatabaseHelper> {

Then when you call getHelper(), ORMLite can figure out automagically which DatabaseHelper helper class to use. There are other ways to setup the wiring for ORMLite. I'd take a look at the Android starting docs and then take a look at the Android example programs.

Community
  • 1
  • 1
Gray
  • 115,027
  • 24
  • 293
  • 354