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 8338377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:34:30+00:00 2026-06-09T04:34:30+00:00

I encountered a strange error related to Java using Intellij Idea. So there is

  • 0

I encountered a strange error related to Java using Intellij Idea.

So there is such interface :

<T> void save(T aEntity, DbTransaction dbTransaction, Class<T> clazz);
<T> void save(Collection<T> aEntities, DbTransaction dbTransaction, Class<T> clazz);

When I try to compile the next code :

@SuppressWarnings("unchecked")
@Override
public void save(Collection<T> aEntities, DbTransaction aDbTransaction) {
    baseDao.save(aEntities, aDbTransaction, getClass((T) aEntities.toArray()[0]));
}

I receive the next compilation error :

reference to save is ambiguous, both method <T>save(T,DbEntityHelper.DbTransaction,java.lang.Class<T>) in xzc.dao.IBaseDao and method <T>save(java.util.Collection<T>,DbEntityHelper.DbTransaction,java.lang.Class<T>) in xzc.dao.IBaseDao match

Do you have any ideas ?
Thanks for help in advance.

  • 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-06-09T04:34:31+00:00Added an answer on June 9, 2026 at 4:34 am

    You have two types called T and it can’t assume they are the same. T could be Collection<T> in the second method or it could be T in the first.

    You can use

    baseDao.<T>save(....
    

    or

    baseDao.<Collection<T>>save(....
    

    to make it clear which one it should be. Making them the T same name doesn’t help the compiler and may just be confusing.

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

Sidebar

Related Questions

I have been trying to output XML with PHP but encountered a strange(!) error
I have encountered a strange error relating to template class in C++. The codes
I've encountered a strange issue using CompiledQuery.Compile . When trying to use a static
After troubleshooting a strange error, I encountered this: echo strtotime(2050/09/19); returns false Why? Thanks!
I have encountered a very strange problem in using jQuery load() . I used
I've encountered a rather strange error. I've written an android application that uploads an
I encountered a strange error, which I believe is a bug. Here is a
I'm working with MVC 3 and have encountered a strange error. I have customErrors='On'
I encountered a really strange error yesterday when I refactored the start page of
Encountered a strange problem with this event, event wrapper and handler: public delegate void

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.