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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:08:32+00:00 2026-06-01T20:08:32+00:00

my case is : a save method in ResourceService<T , ID > public interface

  • 0

my case is : a save method in ResourceService<T , ID >

public interface IResourceService<T,ID>

public class ResourceService<T , ID> implement IResourceService<T,ID>
{
   public void save(T entity) throws RuntimeException {

    try {
        AsyncServiceSaveRunable<T> task = new
AsyncServiceSaveRunable<T>(getService(),entity);

        this.treadPoolExcutor.submitTask(task);
    } catch (NoSuchMethodException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }


   }
}

and in

public class AsyncServiceSaveRunable<T> implements Runnable  {
private IResourceService<?,?> service; //----> this is 
private Method serviceMethod;
private List<T> parameters;

public AsyncServiceSaveRunable(IResourceService<?,?> service,  List<T> parameters){ 
}

public AsyncServiceSaveRunable(IResourceService<?,?> service, T parameter)
                            throws NoSuchMethodException, SecurityException{

    this.service         = service;

    this.parameters = new ArrayList<T>();
    this.parameters.add(parameter);
}
@Override
public void run() {
    try {
        if(this.parameters.size()>1)
            service.saveList(this.parameters);
        else
            service.save( this.parameters.get(0));
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

  }
 }

the problem is service.saveList(this.parameters); and service.save(…);
are wrong

is there anyway to pass that parameter
or i need a different of structure to deal this kind of case?

Thanks

——————error message from eclipse ————————

The method save(capture#7-of ?) in the type IResourceService<capture#7-of ?,capture#8-of ?>
 is not applicable for the arguments (T)
  • 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-01T20:08:33+00:00Added an answer on June 1, 2026 at 8:08 pm

    In ResourceService<T extends BaseEntity, ...> you require T to be drevied from BaseEntity.

    In public class AsyncServiceSaveRunable<T> T has no restrictions.

    Then in service.save(this.parameters.get(0)); you try to pass the (unbounded) generics type to a function that requires a BaseEntity object (or one derived from it).

    You can require the type parameter of AsyncServiceSaveRunable to be derived from BaseEntity as well:

    public class AsyncServiceSaveRunable<T extends BaseEntity>
    

    UPDATE:
    The error message is that the first type parameter of IResourceService is not valid for the type required by save(). Previously you had the type parameter bounded by BaseEntry, but this restriction is now missing. Maybe you want to write: IResourceService<? extends BaseEntity, ? extends Serializable>?

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

Sidebar

Related Questions

I have two generic save methods in a repository class: public void Save<T>(T entity)
Assume a legacy class and method structure like below public class Foo { public
Case One Say you have a little class: class Point3D { private: float x,y,z;
Case i'm trying to write a GWTTestCase for a certain class, used as a
The case: There is a .net application calling unmanaged C code. Used method for
I'm looking at an example of a save method in a Products repository from
From the C# documentation: The Save method is a combination of Insert and Update.
Should the save method be called after every create method or does calling the
Each time the save() method is called on a Django object, Django executes two
My django model looks like this: class Entity(models.Model): name = models.CharField(max_length=40) examples = models.ManyToManyField(Example,

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.