Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORMLite examples for Android won't compile

I have been trying to work through the HelloAndroid example for ORMLite but haven't been able to successfully compile. I am having a problem with the DatabaseHelper class. Specifically the getDao() method:

/**
* Returns the Database Access Object (DAO) for our SimpleData class. 
* It will create it or return the cached value.
*/
public Dao<SimpleData, Integer> getDao() throws SQLException {
  if (simpleDao == null) {
    simpleDao = getDao(SimpleData.class);
  }
  return simpleDao;
}

Here is the compile time error I am receiving:

Type parameters of D cannot be determined; no unique maximal instance exists for type variable D with upper bounds com.j256.ormlite.dao.Dao,com.j256.ormlite.dao.Dao

like image 264
curtisthibault Avatar asked Nov 25 '11 06:11

curtisthibault


1 Answers

I got a similar error when trying to build my ormlite project using Netbeans:

Compiling 15 source files to ~/NetBeansProjects/Main/build/classes Main.java:74: type parameters of D cannot be determined; no unique maximal instance exists for type variable D with upper bounds com.j256.ormlite.dao.Dao,com.j256.ormlite.dao.Dao pcDao = DaoManager.createDao(connectionSource, PC.class);

Due to the comments I switched my Java Platform from OpenJDK 1.6 to Oracle's JDK 1.7.0_02 and it resolved the issue.

like image 151
k0pernikus Avatar answered Sep 18 '22 20:09

k0pernikus