- This topic has 10 replies, 2 voices, and was last updated 17 years, 3 months ago by Riyad Kalla.
-
AuthorPosts
-
RenenMemberHello,
I just rewrote some code to take advantage of JDK 1.5’s optional parameters. But, the JSP pages don’t seem to handle the optional parameters (the optional parameters appear as simple arrays. And the parameters can’t be omitted).
Any input would be appreciated.
Thanks in advance.
renen.
RenenMemberMaybe I should also add, other 1.5 constructs do work (autoboxing etc).
Riyad KallaMemberMoving to OT > Soft Dev
Renen some example code would probably make any help others had easier to give (off hand I don’t know, I’ve never tried using the optional args)
RenenMemberThanks for your time. I would like to figure it out, so here goes:
I have a stateless EJB called DB2 (nothing to do with IBM). Within this class I can execute:
execute("exec", 234, "xx", "yy", 43, "blah");
However, when I try to call it from a different EJB, things don’t work:
db().execute("string", 4, "param", "param", 1652, "message" );
(However, other calls do work).
I think the problem may be that I have too many definitions of the same execute function, all with notionally different signatures – and some of which take variable numbers of parameters at the end (which, I think, sows the confusion). In fact, I’m sure of it because when you push F3, it takes one to the wrong function!
It gives the rather weird impression that it works in one context but not the other.
I will apply my mind a bit more and post a follow up if / when I reach a conclusion.
Renen.
RenenMemberSome headway.
The first point is that java matches the shortest signature it can for a method. So, I was definitely muddling things up. I have tidied the methods and made sure that there can be no ambiguity around which method is being called. I am, though, not out of the woods yet.
From other classes, or JSP pages, the method signature is reflected as, for example:
execute(int processID, Object[] parameters)
instead of:
execute(int, Object...)
My suspicion is that the other modules are not looking at the code from a java 1.5 perspective. Specifically, there is a setting under Project | Properties | MyEclipse which reads J2EE Specification: 1.3. What is this and how do I change it?
Again, I appreciate your input.
Thanks.
Renen.
Riyad KallaMemberRenen,
The project specification level can only be changed during the project-creation step (you can choose between Java EE 5, J2EE 1.4 and 1.3)
RenenMemberThanks. I have made some headway: when I run xdoclet, the interface class is incorrectly generated:
/** * @ejb.interface-method view-type="remote" * @ejb.transaction type="Never" **/ public RowSet execute(String sql, Object...parameters) throws SQLException {
becomes:
public javax.sql.RowSet execute( java.lang.String sql,java.lang.Object[] parameters ) throws java.sql.SQLException, java.rmi.RemoteException;
which is, to my mind, wrong.
Again, thanks for your time and input. Any ideas on how to remedy this would be hugely appreciated!
RenenMemberJust upgraded to MyEclipse 6.0. And reran xdoclet. The interfaces are still generating incorrectly.
Anyone got any ideas?
Riyad KallaMemberThis message has not been recovered.
RenenMemberThis message has not been recovered.
Riyad KallaMemberThis message has not been recovered.
-
AuthorPosts