I want to create a finder method which sends an array or more than one value to the finder method. The finder method...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
will return Collection. Is it possible to send an array as an argument to the finder?
One workaround, I thought, is to send the comma-separated string and put that string into IN operator using EJBQL. But the problem is => My table has a field whose datatype is number. It gives me invalid number error. Please help me to overcome this problem.
The answer to the question concerning passing an array as an argument to the finder method is, yes, and here is why.
javax.ejb.EJBHome and javax.ejb.EJBObject both extend java.rmi.Remote. This implies that they must adhere to the Java RMI specification. RMI requires that parameters and return types be primitive types, objects that implement java.io.Serializable or objects that implement java.rmi.Remote. Since the client/server interaction with a finder method is a remote operation, the parameters and return type of the finder method must be serializable.
Serializable objects are objects that implement the java.io.Serializable interface as a declaration that they have the ability to be read from or written to a stream. An array is a reference type that implements the java.io.Serializable interface. Thus, an array is serializable and therefore eligible to be the parameter of a finder method. However, for an array to be completely serializable, its components must also be serializable.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.