EJB QL parameters

Is it possible to insert the parameters into closes other than where?
For instance:
SELECT object(a)
FROM ?1 AS a
WHERE a.id = ?2;

Hi,
It seems you can't do that.
Have a look at http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBQL5.html#69195
Regards,
Narinder

Similar Messages

  • EJB method parameters are sent but nulls are received

    My client calls my EJB method passing two serializable objects as parameters.
    Using print statements and a network snoop I have confirmed that:
    - the client is calling the method with valid objects
    - from examining the data it appears that the objects are being serialized and sent across the network
    - the EJB seems to receive null values.
    I have deployed the EJB to both 9iAS and a standalone instance of OC4J with exactly the same results.
    Any ideas?

    Hi Dale and Kamesh,
    No error messages? Nothing in the log files? Have you tried running OC4J in debug mode? In case you haven't already seen it, this "Technical Note" has more details.
    Pardon me if I am stating the obvious, but it seems like there is a deserialization problem. Are the client JVM and server JVM both the same version? Have you implemented custom [de]serialization for the parameter classes? Is the same version of the parameter class files located both at the client and at the server?
    Good Luck,
    Avi.

  • Custom authorization provider for WL7 problem (not getting all parameters from ContextHandler)

    I'm implementing a custom authorization provider for WebLogic 7.
    In my Access Decision isAccessAllowed method I need to check values of
    the parameters passed to an EJB method. Now, if an EJB method I have
    two parameters of the same type, for example int, when I get
    ContextElement array from ContextHandler and iterate through it to get
    names and values of the parameters I get the same value (value of the
    first int parameter) from both ContextElement's.
    Here is the code:
    String [] names = ch.getNames();
    for (int i = 0; i < names.length; i++)
    String name = names;
    System.out.println("name = " + name);//here it gets array of
    Strings, which contains two parameter names: "int","int",
    which are the types of EJB method parameters
    ContextElement[] ces= ch.getValues(names);
    for (int j = 0; j < ces.length; j++)
         ContextElement ce = ces[j];
         System.out.println(ce.getName()+ " = " + ce.getValue());
    //here if the value of the first int was 2 and the second 0,
    it would get 2 from both ContextElements (each of ContextElements will
    have name "int"
    If I try this with method parameters of different types, for example
    int with value 2 and long with value 0, then this code work fine -
    first ContextEleement has name int and value 2 and the second has name
    long and value 0.
    Thanks,
    -Oleg Kozlov.

    I'm implementing a custom authorization provider for WebLogic 7.
    In my Access Decision isAccessAllowed method I need to check values of
    the parameters passed to an EJB method. Now, if an EJB method I have
    two parameters of the same type, for example int, when I get
    ContextElement array from ContextHandler and iterate through it to get
    names and values of the parameters I get the same value (value of the
    first int parameter) from both ContextElement's.
    Here is the code:
    String [] names = ch.getNames();
    for (int i = 0; i < names.length; i++)
    String name = names;
    System.out.println("name = " + name);//here it gets array of
    Strings, which contains two parameter names: "int","int",
    which are the types of EJB method parameters
    ContextElement[] ces= ch.getValues(names);
    for (int j = 0; j < ces.length; j++)
         ContextElement ce = ces[j];
         System.out.println(ce.getName()+ " = " + ce.getValue());
    //here if the value of the first int was 2 and the second 0,
    it would get 2 from both ContextElements (each of ContextElements will
    have name "int"
    If I try this with method parameters of different types, for example
    int with value 2 and long with value 0, then this code work fine -
    first ContextEleement has name int and value 2 and the second has name
    long and value 0.
    Thanks,
    -Oleg Kozlov.

  • WebServices and JCO

    Hi I'm a newbie in SAP area.
    I'm a java developer, my task is to create a set of WebServices in NetWeaver which will connect to SAP backend. For communication with SAP I can use SSO.
    I've created a stateless session EJB with parameters ssoCookie and username.
    I've selected to use authorization using Ticket module.
    I have a client which is able to connect to the WS (the client is written in JS - AJAX)
    The problem is that the parameter ssoCookie seems to be useless, the session must be present in the request to the WS.
    Can I retrieve it somehow? I haven't found any way in VI interface or in some SOAP Extension..
    My question is, how can I retrive the ssoCookie in my Java code?

    HI,
    Please look at following weblog
    /people/sap.user72/blog/2004/10/25/sap-logon-ticket-based-single-sign-on
    it might help.
    Thanks,
    Tuhin

  • Unicode strings support

    Anyone else have problems with unicode strings with ADFm?
    I found very strange behavior (bug?) with unicode strings passed through ADFm bindings to EJB method parameters.
    The method is invoked only once when non-unicode (plain ASCII) characters involved.
    The same PageDef invokes method twice(?!) when parameter receives unicode characters from page! Not only that, but the second time method is invoked with completely messed-up string values (two-byte unicode chars replaced with ?).
    Obviously this behavior is making any globalized application (with unicode inputs) development impossible.
    Am I doing something wrong here?
    In several other threads I found complains on JDev (even 11g) not handling Unicode/UTF-8 properly. But I could not find any Oracle statements on this issue and commitment to true and easy Unicode application development support.

    Hi Steve,
    I have just sent you an email with test-case. You are the 5th person from Oracle I'm sending this same email. :)) But never received any answer, comment, confirmation or even rejection of the case. Please, understand that for use from non-ASCII regions this issue is BIG issue. If I cannot have my local letters in ADF then everything else is not relevant. No one will buy my SW even if I give it for free (and especially if they have to pay for Oracle licenses which are somehow far from free).
    Kind regards,
    Pavle

  • EJB 3.0 - problem reading request parameters

    I'm looking at Spring and TopLink integration and deploying with the EJB 3.0 version. I ran into problems when trying to retrieve a parameter from a request. Since I could not see anything wrong, I deployed with Tomcat and the code executed correctly.
    The simple case below illustrates the problem:
    <%@ page session="false"%>
    <%@ taglib uri="http://jakarta.apache.org/taglibs/request-1.0" prefix="req" %>
    <html>
    <head>
    <title>PetClinic :: a Spring Framework demonstration</title>
    </head>
    <body>
    The ID parameter is: <req:parameter name="id"/>
    </body>
    </html>
    Running with http://localhost:8080/sto12/welcomeURL.htm?id=foo causes foo to be displayed in Tomcat but not in OC4J EJB 3.0. Why is this?
    Thanks
    Mike

    Sorry, I tried to submit the problem in a simplified form and I can see I've just made it more confusing. Let me try again.
    Spring ships with a Petclinic sample. The Spring Toplink integration work has provided new classes that allow the Petclinic example to be deployed using Toplink as the object relational mapping. I have it running using Tomcat, but have had problems using OC4J EJB 3.0.
    In the sample app, there is a JSP that allows surname to be entered, which then calls code to search for Owners with a match on surname. That code treats no matches, one match and many matches differently.
    In the case of no matches, the JSP simply displays a message saying no matches found. In the case of many matches, it uses another JSP to display a list of Owners, from which the desired one is selected. The selected one is then displayed by a further JSP on which updates can be made. Where only one match with surname is found, the selection JSP is bypassed.
    Behind the scenes when obtaining the list of matching Owners, the Toplink code simply obtains a list. When one is selected, a further Toplink access is used which returns the selected Owner by reading via the primary key selected from the list. The essence of the problem is that there is a single piece of code in the sample that makes the Toplink call to read by primary key. When called in one scenario, it works, in the other it does not.
    Where that code is invoked as a result of the user selecting from a list, it is the JSP POSTing the selected Owner that transmits the primary key to the code. The code obtains the key from the request and everything works fine.
    Where only one Owner is found, a redirect is done with the key added as a parameter. When the same code as above attempts the retrieve the key, it is unable to do so ie it returns null and the subsequent Toplink call fails.
    Since the above obscures the problem, I played around with two of the JSPs provided - welcome.jsp and index.jsp. In the sample, index.jsp is included in the web.xml under <welcome-file-list> and hence is used when the app is started. It simply redirects to welcome.jsp. (I believe the reason is that all requests go via the Spring DispatcherServlet and are forwarded to the appropriate JSP depending on configuration - hence the comment that they are "virtual").
    When I put code in the index.jsp to display an id parameter and start it with an id provided, it displays the id parameter. When I let the index.jsp simply redirect to welcome.jsp (with an id included and welcome.jsp changed to display the value)it does not display the value.
    I'm sorry this has become a long post. The gist seems to be that I can't extract parameters from requests that have been redirected. As I said at the top of this note, this is not the case with Tomcat - I can run the same code there and retrieve parameters from a request, whether it has been redirected or not. I've posted in this forum because I believe the problem is with OC4J not with Spring or Toplink. I could be wrong.
    Any suggestions are very welcome.
    Mike

  • Passing parameters from Communication channel to EJB Module

    Dear friends,
    We have an EJB module in NWDS. We want to pass some parameters from Communication Channel (Sender) in Integration Directory and use them in our EJB Module. Is there any function to do this process?? Please help me out
    Thanks and Regards,
    N.Jayanth Kumar

    Hi,
    Use the Channel object in this manner:
    String cid  = moduleContext.getChannelID();
    channel = (Channel) LookupManager.getInstance().getCPAObject(CPAObjectType.CHANNEL, cid);
    //To access channel parameters e.g in file adapter the connection parameters like host use the below code
    String host = channel.getValueAsString("ftp.host");
    PS: it is assumed that you are having the source code for adapter module development found on server
    Regards,
    Fariha

  • EJB QL array parameters

    Hello,
    Whats the deal with these array parameters?
    I posted a similar comment to the conversation at:
    http://forum.java.sun.com/thread.jspa?threadID=484953&tstart=0
    Basically I would like to pass an array of integers to a "WHERE IN (?1)" clause of my EJB QL query and have it retrieve EJBs for each of the integer PKs. I used regular sql call to get a list of items that the user wishes to see, but I am struggling with rendering them on the results page without calling a finder method n times where n is the number of found items.
    I'm using Rational Application Developer 6.0.1 w/ WebSphere App Server 6.0. In the ejb-ql descriptor page I am able to define my queries and even the parameters too. It even has a checkbox whether or not the param is infact an array. When I check it, I get java.lang.int[][]: doesn't two sets of square brackets like that indicate a multi-dimensional array? I would have expected it to have simply done a single box like java.lang.int[]. Am I overlooking something obvious here (or not so obvious!)?
    Here is the code it generates that it is unable to work with (complains about not being able to find the query):
      <query>
         <description></description>
         <query-method>
         <method-name>findByIds</method-name>
         <method-params>
              <method-param>java.lang.int[][]</method-param>
         </method-params>
      </query-method>
      <ejb-ql>select object(o) from Hproblog o where  o.probtrakno in (?1)</ejb-ql>
    </query>

    Thx for your put :)
    I tried that out, and as far as I can tell I don't think I can even put arrays in as params!
    I tried java.lang.Integer[], int[], and even java.lang.String[] and I always got the same error generating the query:
    Error=unknown EJB or ASN name: java.lang.int[]
    Error=unknown EJB or ASN name: java.lang.Integer[]
    Error=unknown EJB or ASN name: java.lang.String[]I wonder if there is simply an error in the EJB editor in RAD 6.0.1? It appears the intended to support arrays but something I'm either doing wrong or how I've gotten setup is not allowing me to generate any queries with arrays :(
    Hmm somehow in retesting those three to be sure that those errors did occur, I failed to reproduce the double [][] multi-dimensional parameter (unfortunately I think I did the Refresh Update 6.0.0.1 --> 6.0.1 right in the middle, so I don't know exactly know if that is still an issue).
    I looked up ASN and it means Abstract Schema Name, so I'm not entirely sure how to apply that in this context, any ideas?
    Thx for your comments.

  • EJB Web Service Interface parameters name changed

    Hi, all,
    I create a simple Session EJB 3.0 with Web Service interface in Jdeveloper 10.1.3.4. and I deployed it into the embedded OC4J server.
    The question is I found that the web service operator parameters is changed to "String_1" (actually the parameter in EJB method is String ss). And I found the WSDL file is also String_1.
    How to create the real parameter name in WSDL from EJB Web Service interface? Any help on that?
    Best Regards,
    Bill

    if you do a lookup for the name "java:comp/env/ejb/queryProc" in the servlet, the deployment descriptor of your web-archive must contain an ejb-reference with the ref-name 'ejb/queryProc'.

  • Global Application Parameters for EJB

    Hello all, I did a search for this on these forums and there are there a TON of threads of developers wanting to implement the classic Singleton pattern so that all EJB's of an application can access "Global Application Parameters". Most of these I've been reading achieve this by workarounds that breakdown at the clustering level, since Singletons won't span multiple JVMs.
    Suppose you deploy an EAR that only has EJB jars, so you don't have access to all the convenience of the web tier (context parameters, context Initialization, etc.), so there is no way for your EJB's to detect/intercept an "Application Startup" event and load any necessary values into a Global Application parameter repository.
    This seems such a widely demanded functionality that I wonder if there now a "best practice" way to achieve equivalent of the Singleton pattern in the EJB world that works nicely in a clustered environment?

    I have the same problem
    Thanks

  • How are the parameters passed by an EJB?

    I got a problem on parameters passing of my bean and also got confused.
    Let's say my Bean has a method call update(MyObject o);
    In the client side, I do
      MyObject obj = new MyObject();
      myBean.update(obj);
      In the bean side, I do
      public void update(MyObject obj) {
        obj.setX(100); // let say this change one of the members of MyObject
      Now, in my client side after the bean update() method call, do I see the changes in MyObject obj? If I do get the changes, the bean must be doing a reverse stub-skeleton call to update my client copy, is that true or I should not assume that?
    I was not thinking about all these when developing and the above code works as my assumption in WebLogic 5.1 and 6.0. But, when I port my bean to WebSphere 3.5, the above code crap out -- the client does not see the changes!!
    Does anyone know what the inside of this or have any suggestions?

    Thanks Jerome, harpreet,
    What you two say make sense, however, the problem is still a mystery.
    I started developing without thinking of the local copy or remote copy of the parameters between the client and the bean. WebLogic somehow reads my mind and worked the way I wanted (the parameter changes affect the the client copy, how they do that?).
    When I finished coding and started porting my bean to WebSphere, I realized beans in WebSphere work in a conceptually different way (parameters are passed by value).
    Unfortunately WebSphere works in a kind of logical way but not what I wanted, and WebLogic works magically as I intended but I don't understand how they do it.
    So, the question comes down to Are parameters passed by reference or passed by value in EJBs?
    If WebLogic passes parameters by reference, is it doing a reverse stub-skeleton call?
    If WebSphere passes parameters by value, how can I make it pass by reference?
    --Lichu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Jndi connection parameters for deplyoing ejb

    Hi All,
    I am new to ejbs.I am trying to deploy session bean to jboss3.2.7 app server.Can anyone please let me know how should i pass jndi connection parameters in the client side code.In some tutorials i have seen that jndi.properties file has to be in the classpath but they didn't provide contents of it .Can anyone please let me know the solution.

    Hello SoumyaSoma,
    Please find some code cnippet I use to connect to JBoss Server. you do not need jndi.properties file.
    String url = "jnp://localhost:1099";
    Properties h = new Properties();
    h.put (Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    h.put ("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
    h.put (Context.PROVIDER_URL, url);
    Context ctx = new InitialContext(h);
    See the weblink for more information also.
    http://www.huihoo.com/jboss/online_manual/3.0/ch01s15.html
    Thanks and regards,
    Pazhanikanthan. P

  • How OSB pass Initial Context parameters to EJB

    For security reasons I have to pass a ticket (through initial context) to legacy system from OSB for calling EJB, below is a code
    Hashtable env = new Hashtable(2);
    env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.PROVIDER_URL, connectionUrl);
    env.put(javax.naming.Context.SECURITY_PRINCIPAL, ticket);
    env.put(javax.naming.Context.SECURITY_CREDENTIALS, "");
    InitialContext ctx = new InitialContext(env);
    Object homeRef = ctx.lookup("com.cih.services.contact.interfaces.IContactServiceRemote");
    IContactServiceRemoteHome home = (IContactServiceRemoteHome) javax.rmi.PortableRemoteObject
    .narrow(homeRef, IContactServiceRemoteHome.class);
    IContactServiceRemote ejb = home.create();
    Please let me know how we can pass Initial context parameter from Business service or proxy service to legacy system.
    Thanks

    Hi Russ
    Yes, I've done this too. Basic SQL though will not allow the updating of a table inside a function, so we have to get clever. The trick is to use the PRAGMA AUTONOMOUS TRANSACTION command. Here's an example:
    FUNCTION UPDATE_MYTABLE(P_VALUE IN NUMBER)
    RETURN VARCHAR2 IS
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    UPDATE SCHEMA_OWNER.MY_TABLE SET MY_VALUE = P_VALUE;
    COMMIT;
    RETURN('Done');
    END UPDATE_TABLE;
    When the update has been completed the Discoverer worksheet will respond with 'Done'.
    Everyone: don't forget to grant EXECUTE on this function to all of the necessary users, including the EUL owner, and also don't forget to import the function using the Admin edition so that it is available for the users. You will also need to make sure that all necessary users have been granted the UPDATE privilege on the table.
    I hope this helps
    Regards
    Michael

  • Setting Run-time parameters for EJB objects

    Hello,
    I need to set a run-time paramater that will be used by the session beans in my
    application. I looked thru the documentation, but I'm not finding an obvious
    way to do this.
    In weblogic-application.xml, there is an <application-parameter> element that
    seems promising, but I can't find a weblogic method for getting the value of this
    element from within an EJB.
    Any ideas on the best way to do this?
    Thank you

    Ellen,
    There is no global <env-entry> that you can use currently, but you can make
    an
    <env-entry> in the EJB module's descriptors for each session bean that needs
    the run-time parameter.
    the <application-parameter> element you speak of is not a place that
    arbitrary
    values can be placed and obtained. That element is used to by the server
    and there are a specific set of values that are recognized
    as override options for the server to use for the application.
    Michael Kovacs
    Senior Software Engineer
    BEA Systems
    "Ellen Kraffmiller" <[email protected]> wrote in message
    news:3f857657$[email protected]..
    >
    Hello,
    I need to set a run-time paramater that will be used by the session beansin my
    application. I looked thru the documentation, but I'm not finding anobvious
    way to do this.
    In weblogic-application.xml, there is an <application-parameter> elementthat
    seems promising, but I can't find a weblogic method for getting the valueof this
    element from within an EJB.
    Any ideas on the best way to do this?
    Thank you

  • Cannot deploy EJB from JDev 3.2

    Dear Sirs,
    When you try to create a deployment profile using JDeveloper 3.2 step #2 of the wizard asks for "select a type of deployment". In Jdeveloper 3.1.1.2 the option "deploy Enterprise Java Bean (EJB) to Oracle8i". But in release 3.2 that option is taken away.
    Does this mean Jdeveloper does not support the EJB 1.1 spec (i.e. the XML deployment descriptor)? Or must I upgrade the database from 8.1.6 to 8.1.7. Or is this a bug?
    regards.

    Hello:
    Can anyone helps us with this EJB problem in Oracle? :
    With JDeveloper 3.1.12 we can deploy with the wizard an EJB component in Oracle (database) 8.1.6 but the client test fails with the following message:
    "oracle.jbo.ApplicationModuleCreateException:
    JBO-25222: Unable to create application module...."
    In an Oracle error log file (in the bdump directory) we find the following information:
    "Attempt to call System.getProperties failed
    ...skipping...
    at oracle.jbo.server.remote.ejb.EJBApplicationModuleImpl.ejbCreate
    (EJBApplicationModuleImpl.java:183)..."
    We think that the problem is related with:
    1- memory parameters of Oracle 8i ?
    2- Java security permissions in the server ?
    Thanks you for your help.
    Maria Consuelo Franky - Victor Toro
    CincoSOFT Ltda.
    Bogota - Colombia
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by slag:
    Oracle (database) 8.1.6 only supports 1.0 spec, 8.1.7 is 1.1 spec compliant, to my knowledge.
    [b]slag<HR></BLOCKQUOTE>
    null

Maybe you are looking for