I am having issues with regarding the overloading of the Request Context.
I have the following:
public interface TaskAssignmentRequest extends RequestContext {
.
.
.
Request<List<TaskAssignmentProxy>> findTaskAssignmentByProjectIds(List<String> id);
Request<List<TaskAssignmentProxy>> findTaskAssignmentByProjectIds(List<String> id, Date start_date, Date end_date);
I am getting the following errors when I am running my code
SEVERE: Method overloads found in type com.abc.server.TaskAssignmentService named findTaskAssignmentByProjectId:
java.util.List findTaskAssignmentByProjectId(java.lang.String java.util.Date java.util.Date )
java.util.List findTaskAssignmentByProjectId(java.lang.String )
Is overloading not allowed in this case? I do not see why not.
Thanks,
Nadin
RequestFactory doesn't currently (as of GWT 2.2) support method overloads in service APIs.
Could it be that those are the only methods it could find, when it's looking for the methods with the List<String> parameter? The methods you've listed just have a plain String for the first parameter.
Related
I had a certain method that called MongoOperations.find(Query query, Class<T> entityClass, String collectionName), and returned a List<T> as expected. I want to change the method to stream(), in case the number of returned objects from the query is exceptionally large. According to the documentation, there should be an identical signature for stream(), but when I try to call the function with a collectionName, I get an error:
groovy.lang.MissingMethodException: No signature of method: org.springframework.data.mongodb.core.MongoTemplate.stream() is applicable for argument types: (org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String)
When I remove the collectionName, it runs without error. Could this be an issue of Spring Data versions? How can I solve this?
Thanks.
The overloaded stream method which takes collection name as an argument in MongoOperations is added in Mongo Spring 1.10 version.
The change is covered as part of the ticket. https://jira.spring.io/browse/DATAMONGO-1431
We are facing weird injection issues in Widfly due to CDI changes. We have interface
public interface Command<I, O> {
}
and many classes implement this interface like this
public class ApproveUserRequests implements Command<ApproveUserRequestsRequest, List<String>> {
}
Application listener classes likes to get list of all classes available and uses injection like this
#Inject
private Instance<Command<I, O>> mActions;
However instance returned by mActions were always null. After debugging source found that the only way to get list of all instances is to use
#Inject
private Instance<Command<?, ?>> mActions;
Also we faced injection issues while using generic types , however using wildcard type helped us.
- See more at: https://developer.jboss.org/thread/256783#sthash.1s6tuXsR.dpuf
The rules for parameterized types have been clarified in CDI 1.2. Have look at Section 5.2.4 Assignability of raw and parameterized types of the spec.
Can we have overloaded methods in mapper interface? If yes, how does mybatis differentiate the elements in mapper xml?
Can we have overloaded methods in mapper interface? If you mean to implement Mapper interface --> NO
Mybatis defferentiate the elements in mapper xml by the "id".
For example if we have an addUser method without annotation we can overload it in xml file by specifying id="addUser":
public interface UserMapper {
void addUser( String name);
}
xml Mapper :
<insert id="addUser" ... >
No. I am afraid that is not supported and seems it won't be. More recent request was made for the same feature, but it is marked as wontfix
The question was originally asked at http://entityframework.codeplex.com/discussions/399499#post928179 .
Good day! Please tell me if it is wrong place to post this question.
I have a query as follows:
IQueryable<Card> cardsQuery =
dataContext.Cards
.Where(predicate)
.OrderByDescending(kc => kc.SendDate)
.AsQueryable();
Then I try:
Task<Card[]> result = cardsQuery.ToArrayAsync();
And then exception rises:
The source IQueryable doesn't implement IDbAsyncEnumerable<Models.Card>
I use modified version of 'EF 5.x DbCotext generator'.
How to avoid it?
UPDATE
Important remark is that I have method to produce IQuerayble<Card> as follows:
class Repository {
public IQueryable<Card> GetKudosCards(Func<Card, bool> predicate) {
IEnumerable<KudosCard> kudosCards = kudosCardsQuery.Where(predicate);
return kudosCards
.OrderByDescending(kc => kc.SendDate)
.AsQueryable();
}
}
What is the point of calling AsQueryable? If you compose a query with the extension methods starting from an IQueryable source collection (e.g. DbSet, ObjectSet), the query will be IQueryable too.
The purpose of AsQueryable is to wrap an IEnumerable collection with an IQueryable proxy/adapter that uses a Linq provider that is capable of compiling IQueryable queries into a Linq to Object queries. This can be useful in scenarios when you would like to use inmemory data queries.
Why is the AsQueryable call necessary? What if you just simply remove it?
Update
Okey, now it seems I understand your problem. After a quick look on the ODataQueryOptions.ApplyTo I realized that it just extends the underlying expression tree of the query. You can still use it to run the query in the way you want, however you need a little trick to transform the query back to generic.
IQueryable<Card> cardsQuery =
dataContext.Cards
.Where(predicate)
.OrderByDescending(kc => kc.SendDate);
IQueryable odataQuery = queryOptions.ApplyTo(cardsQuery);
// The OData query option applier creates a non generic query, transform it back to generic
cardsQuery = cardsQuery.Provider.CreateQuery<Card>(odataQuery.Expression);
Task<Card[]> result = cardsQuery.ToArrayAsync();
The problem is as follows.
I have a method:
class Repository {
public IQueryable<Card> GetKudosCards(Func<Card, bool> predicate) {
IEnumerable<KudosCard> kudosCards = kudosCardsQuery.Where(predicate);
return kudosCards
.OrderByDescending(kc => kc.SendDate)
.AsQueryable();
}
}
The problem is that kudosCards has type IEnumerable<KudosCard>. That throws exception. If I change predicate type to Expression<Func<Card, bool> predicate then everything works just fine.
I had the same problem when I was using the LinqKit library expression builder, which in the end, was producing AsQueryable(), and very surprisingly it was happening for me from the XUnit Integration Tests call.
I was going wild about why the same problem wasn't happening when calling the same API endpoint via Swagger.
It turned out I had to do an elementary change.
I had to replace:
using System.Data.Entity;
with:
using Microsoft.EntityFrameworkCore;
I had the same problem when I was using the LinqKit library expression builder, which in the end, was producing AsQueryable().
And very surprisingly, it was happening for me from the XUnit Integration Tests call.
I was going wild about why the same problem wasn't happening when calling the same API endpoint via Swagger.
It turned out I had to do an elementary change.
I had to replace the:
using System.Data.Entity;
with:
using Microsoft.EntityFrameworkCore;
In the place where I was calling the LinqKit expression method.
If you want to use the List<T> for Linq query, Avoid chaining it with ToListAsync(). It uses the class IDbAsyncEnumerable that is not available to a normal List<T> object
I am having trouble using EnumSet on the client side.
I get this runtime error message:
java.util.EnumSet.EnumSetImpl is not default instantiable (it must
have a zero-argument constructor or no constructors at all) and has
no custom serializer.
Is this is a known issue?
Here is what I am doing (basically a hello world app)
Service:
String echo (EnumSet<Names> name) throws IllegalArgumentException;
Client:
echoServ.echo (EnumSet.of(Names.JOHN), new AsyncCallback<String>()
{ ....... });
Shared enum class
enum Names { JOHN, NUMAN, OBAMA }
This is a GWT limitation - See http://code.google.com/p/google-web-toolkit/issues/detail?id=3028
The simplest workaround is to use a HashSet until that is fixed
It seems the problem is that EnumSet is not serializable according to GWT's rules:
It is assignable to IsSerializable or Serializable, either because it directly implements one of these interfaces or because it derives from a superclass that does
All non-final, non-transient instance fields are themselves serializable, and
As of GWT 1.5, it must have a default (zero argument) constructor (with any access modifier) or no constructor at all.
See the docs for more info.