Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7564349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:52:55+00:00 2026-05-30T13:52:55+00:00

Error appears in android project using ormlite I get compilation error on this code:

  • 0

Error appears in android project using ormlite
I get compilation error on this code:

public class DatabaseModel {
        private Dao<Object, Integer> mDao = null;
        private DatabaseHelper mHelper;
        private Class<?> mClass;

        public DatabaseModel(DatabaseHelper h, Class<?> c) {
                mHelper = h;
                mClass = c;
                try {
                        mDao = mHelper.getDao(mClass);
                } catch (SQLException e) {
                        Debug.e("Can't get dao", e.getStackTrace());
                        throw new RuntimeException(e);
                }
        }

on line 25 mDao = mHelper.getDao(mClass);

Error: type parameters of <D>D cannot be determined; no unique maximal
instance exists for type variable D with upper bounds
     com.j256.ormlite.dao.Dao<java.lang.Object,java.lang.Integer>,
     com.j256.ormlite.dao.Dao<capture#296 of ?,?>

But when i tries to build project using eclipse it works fine

The error looks similar to this SO question.

I don’t know whether this bug of Idea or javac.

My configuration:
IntelliJ IDEA 11.0.2
Build #IC-111.277
Built on 1 Февраль 2012 г.
JDK: 1.6.0_29
VM: Java HotSpot(TM) 64-Bit Server VM
Vendor: Apple Inc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:52:57+00:00Added an answer on May 30, 2026 at 1:52 pm

    I’m not getting this error in eclipse but I can see why you would see a problem. mdao is defined as Dao<Object, Integer> but you are calling getDao(mClass) where mclass is a Class<?>. Object != ? in generic land.

    You could turn your entire class into a generic type. Something like the following would work.

    public class DatabaseModel<T, ID> {
        private Dao<T, ID> mDao = null;
        private DatabaseHelper mHelper;
        private Class<T> mClass;
    
        public DatabaseModel(DatabaseHelper h, Class<T> c) {
            mHelper = h;
            mClass = c;
            try {
                mDao = mHelper.getDao(mClass);
            } catch (SQLException e) {
                Debug.e("Can't get dao", e.getStackTrace());
                throw new RuntimeException(e);
            }
        }
    }
    

    That should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This error message appears on a colleague's machine when he tries to launch a
I'm trying to solve a segmentation fault. This message appears in my apache-error.log: [notice]
In my Android application in Eclipse, I get the following error. UNEXPECTED TOP-LEVEL EXCEPTION:
a million error per day using eclipse with the Android plug-in i tried everything
I got a very strange error on my android apk that only appears if
When I execute these two codes, this error in the catLog appears: 03-18 01:05:16.602:
I am trying to include a library into my android project using IntelliJ IDEA
Updated Appears to be a precedence error and nothing to do with the question
I'm getting an error when my application starts. It appears to be after it's
I want to number any JSF error messages (e.g. validation, conversion messages) that appears

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.