Reputation: 235
I really need some help! By invoking an EJB that has method overloading, I'm having the following exception: javax.ejb.EJBTransactionRolledbackException: argument type mismatch
Interestingly, this happens randomly and only in this overloaded method. See the structure below:
// superclass
public abstract class GenericService<T> {
public void update(T object) throws Exception {
// some logic
}
}
// subclass
@Stateless
public class TableService extends GenericService<Table> implements ITableService {
@Override
public void update(Table table) throws Exception {
/*
* some logic
*/
// call super
super.update(table);
}
}
If I invoke TableService.update that contains the super.update(table) statement, the error occurs. But, if I remove ther super.update(table) statement from TableService.update, calling the DAO directly (skipping super), it works.
To make matters worse, it is not often that this happens too. Only when I restart jboss wildfly sometimes.
Apparently there is nothing wrong and should work fully containing the super.update(table) statement. Can you help?
Upvotes: 0
Views: 603
Reputation: 54
The EJB proxy delivered by the container (JBOSS) passes the arguments for the respective method with type Object. Thus, if there are overloading methods maybe the proxy can't resolve wich one to call
@Stateless
public class TableService extends GenericService<Table> implements ITableService {
@Override
public void update(Table table) throws Exception {
/*
* some logic
*/
// call super
super.update(table);
}
@Override
public void update(List<Table> table) throws Exception {
/*
* some logic
*/
// call super
super.update(table);
}
}
proxy.update(Object obj)...
argument type mismatch
Upvotes: 1