Named Queries and Null parameters

I am trying to use null values in the where clause of named query. I have a named query defined in my Workbench (Toplink 9.0.4) and the where claus looks like this.
WHERE PERSON.LAST_NAME=#lastName
If a pass in a value for lastName, say "Jones", Toplink correctly creates a where clause in single quotes:
WHERE PERSON.LAST_NAME='Jones'
However, if I pass in a null value for lastName, Toplink generates this:
WHERE PERSON.LAST_NAME=NULL
This will never select anything, because a value can never "equal" null, but rather it IS NULL or it isn't.
Any ideas out there on how I could get Toplink to substitute "IS NULL" of "=NULL" in such situations?

Different databases handle = null differently. I assume you are on DB2?
You can force a query to dynamically generate its SQL, to ensure that IS NULL is used.
query.setShouldPrepare(false);
In the Mapping Workbench for the query click on 'Advanced Properties' and un-click 'Prepare SQL Once'.
The database may also process the = null correctly if binding is used, but I'm not sure on this.

Similar Messages

  • Named Queries and QueryByExample

    Folks,
    Is it possible to register a named query w/ a descriptors QueryManager AND perform QueryByExample queries?
    If so, can you post an example of UnitOfWork call?

    No, named queries are static, they have a fixed selection criteria and number of parameters. Query by example is dynamic.

  • Named Queries and Finders

    Hi, I would like to know if is there a way (in JDev 10.1.3 or in standalone TopLink Workbench) to generate, during mapping, automatic Named Queries that are finders for the table. In example if I have a table with id, name, surname I would like to have in automatic the Named Queries getById(Long id), getByName(String name), getBySurname(String surname). On I project we used Firestorm DAO, which generate automatically these methods, that are quite useful.
    Thanks in advance,
    Stefano E.

    If you are using TopLink 10.1.3 CMP2 in OC4J 10.1.3 then the CMP runtime will automatically define finders for any finder of the format, "findBy<field>" where <field> is the name of a bean cmf. You do not need to define these finders in the Mapping Workbench nor deployment XML.
    You can use the Mapping Workbench do define these finders as well, but there is nothing in the Mapping Workbench that allows automatic generation of these finders.

  • Named Queries and Enum error

    @NamedQuery(name = "Task.findNumberTasksComplete", query = "select count(o.id) from Task o where o.status like 'C%'")that is the query i am performing. Status is an enumerator type.
    When i try to perform this,
    int numerator = Integer.parseInt(em.createNamedQuery("Task.findNumberTasksComplete").getSingleResult().toString());I get the following error
    Caused by: java.lang.ClassCastException
         at java.lang.Class.cast(Class.java:2951)
         at oracle.toplink.mappings.converters.EnumTypeConverter.convertObjectValueToDataValue(EnumTypeConverter.java:109)
         at oracle.toplink.mappings.foundation.AbstractDirectMapping.getFieldValue(AbstractDirectMapping.java:520)
         at oracle.toplink.internal.expressions.QueryKeyExpression.getFieldValue(QueryKeyExpression.java:293)
         at oracle.toplink.internal.expressions.ConstantExpression.printSQL(ConstantExpression.java:106)
         at oracle.toplink.expressions.ExpressionOperator.printDuo(ExpressionOperator.java:1806)
         at oracle.toplink.internal.expressions.CompoundExpression.printSQL(CompoundExpression.java:266)
         at oracle.toplink.internal.expressions.RelationExpression.printSQL(RelationExpression.java:552)
         at oracle.toplink.internal.expressions.ExpressionSQLPrinter.translateExpression(ExpressionSQLPrinter.java:277)
         at oracle.toplink.internal.expressions.ExpressionSQLPrinter.printExpression(ExpressionSQLPrinter.java:107)
         at oracle.toplink.internal.expressions.SQLSelectStatement.printSQL(SQLSelectStatement.java:1414)
         at oracle.toplink.internal.databaseaccess.DatabasePlatform.printSQLSelectStatement(DatabasePlatform.java:2425)
         at oracle.toplink.platform.database.oracle.OraclePlatform.printSQLSelectStatement(OraclePlatform.java:695)
         at oracle.toplink.internal.expressions.SQLSelectStatement.buildCall(SQLSelectStatement.java:731)
         at oracle.toplink.descriptors.ClassDescriptor.buildCallFromStatement(ClassDescriptor.java:635)
         at oracle.toplink.internal.queryframework.StatementQueryMechanism.setCallFromStatement(StatementQueryMechanism.java:367)
         at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.prepareReportQuerySelectAllRows(ExpressionQueryMechanism.java:1491)
         at oracle.toplink.queryframework.ReportQuery.prepareSelectAllRows(ReportQuery.java:1201)
         at oracle.toplink.queryframework.ReadAllQuery.prepare(ReadAllQuery.java:767)
         at oracle.toplink.queryframework.ReportQuery.prepare(ReportQuery.java:973)
         at oracle.toplink.queryframework.DatabaseQuery.checkPrepare(DatabaseQuery.java:443)
         at oracle.toplink.queryframework.ObjectLevelReadQuery.checkPrepare(ObjectLevelReadQuery.java:608)
         at oracle.toplink.queryframework.DatabaseQuery.prepareCall(DatabaseQuery.java:1528)
         at oracle.toplink.internal.ejb.cmp3.base.EJBQueryImpl.getDatabaseQuery(EJBQueryImpl.java:427)
         at oracle.toplink.internal.ejb.cmp3.base.EJBQueryImpl.setAsSQLReadQuery(EJBQueryImpl.java:95)
         at oracle.toplink.internal.ejb.cmp3.base.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:507)
         at ca.esti.qa.model.QualityAssuranceBean.calculatePercentFinished(QualityAssuranceBean.java:431)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:27)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
         at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:44)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
         at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
         ... 126 moreAny help is greatly appreciated!!
    Dan

    hi Dan
    Maybe this is a question for this forum: "TopLink/JPA"
    TopLink/JPA
    success
    Jan Vervecken

  • SetAdditionalJoinExpression and Named Queries...

    Hi, is it possible to use DescriptorQueryManager.setAdditionalJoinExpression() to append additional filters to sql statement named queries?
    I've tried this but it doesn't seem to have any effect. If this is not possible, do you know of any alternative methods?
    Thanks for you help!
    -Tim Watson

    Yes, if you set the DescriptorQueryManager additionalJoinExpression the expression will be anded will all queries for that descriptor.
    Ensure that you set the additionalJoinExpression before you login.

  • Named Queries

    Hi All,
    I am using TL 4.6 Build 418, Oracle 8.1 & WLS 7.0.
    I am having a hard time getting Named Queries working. Specifically I can't seem to get Toplink to Bind my parameter(s). I have tried to use both EJBQL and plain SQL with no luck using either. The error I get when I use SQL is that from Oracle or JDBC that not all parameters are bound, when I change the stmt to be EJBQL then I get a null where the bound parameter should go. The stmt is super simple.
    EJBQL = SELECT OBJECT(sysuser) FROM SystemUser sysuser WHERE sysuser.username = ?1
    or as
    SQL = SELECT * FROM SystemUser WHERE username = ?1
    For a test I took the mapping work bench code that is generated into java source and pasted it into a test servlet below.
    ReadObjectQuery namedQuery0 = new ReadObjectQuery(com.aravo.security.biz.usermgmt.SystemUser.class);
    namedQuery0.setEJBQLString("SELECT OBJECT(sysuser) FROM SystemUser sysuser WHERE sysuser.username = ?1");
    namedQuery0.setName("getSystemUserwithUserName");
    namedQuery0.setCascadePolicy(1);
    namedQuery0.setQueryTimeout(0);
    namedQuery0.setShouldUseWrapperPolicy(false);
    namedQuery0.setShouldBindAllParameters(true);
    namedQuery0.setShouldCacheStatement(false);
    namedQuery0.setSessionName("security");
    namedQuery0.setShouldMaintainCache(true);
    namedQuery0.setShouldRefreshIdentityMapResult(false);
    namedQuery0.setLockMode((short)0);
    namedQuery0.addArgument("uname", java.lang.String.class);
    clientSession.addQuery("getSystemUserwithUserName", namedQuery0);
    Vector theArgs = new Vector() ;
    theArgs.addElement("[email protected]") ;
    SystemUser su = (SystemUser) clientSession.executeQuery("getSystemUserwithUserName",theArgs) ;
    What I then see is the following in the console. Any ideas why NULL is there instead of [email protected]?
    SELECT PASSWORD, USERNAME, SYSTEMUSERID FROM SYSTEMUSER WHERE (USERNAME = ?)
    bind => [null]
    Thanks,
    Jerry

    It looks like you have a small error in your setup.
    Is see your EJBQL =
    namedQuery0.setEJBQLString("SELECT OBJECT(sysuser) FROM SystemUser sysuser WHERE sysuser.username = ?1");
    But then you pass the argument =
    namedQuery0.addArgument("uname", java.lang.String.class);
    It should be =
    namedQuery0.addArgument("1", java.lang.String.class);
    In other words, the name of the argument from the argument list should be the same as the one in the EJBQL.

  • Outbound HTTP adapter and URL parameters

    Hi all
    I'm having some trouble with a XI scenario I'm supposed to implement.
    I should get invoices from a vendors webserver using a url with parameters (ex. http://myvendor.com/getinvoice.jsp?invoiceid=12345) and send it as INVOICE IDoc to the R/3.
    I thought that would be an easy one using the Plain HTTP-Adapter but I can't figure out how to build the URL. Is there a way to do that, or do I need to implement my own adapter??
    Thanks in advance
    Stefan

    Hi experts ,
    I have this scenario from Legacy to XI to external app server.I have a test jsp to execute that functionality .Its a jsp which has 1 textarea named "test" and when I click on the submit buton I get a response back.This way I am able to test this independently.Now from XI when I am executing my scenario I am getting status code '1250' and message as ' http request(test) is null'.Now in the scenario in http adapter I just provide the target host : ip of server ,
    service number : port no ,
    path: the container or the request handler. But this scenario fails and gives me the above erroneous response.Now Basically I am not able to get how to send the value to the textarea "test"? please provide help as soon as possible.Do we have to put the name of the jsp in the "path" in http adapter and use prolog as test= or should it be &test= .I tried this but it doesnt work.So please provide help on this as soon as possible or please suggest a solution at [email protected]
    Thanx in advance,
    Akshata

  • Two similar queries and different result.

    Hi! I have a problem and
    with
    sc as (select * from nc_objects where object_type_id = 9122942307013185081 and project_id=9062345122013900768),
    cid as (select sccid.value AS CIRCUIT_ID,sc.description AS DESCRIPTION
    from sc, nc_params sccid
    where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590),
    caloc as ( select
    (*select value from nc_params sccid where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590*) as CIRCUIT_ID,
    (select sl.name from nc_objects sl join nc_references scr on sl.object_id = scr.reference
    where scr.attr_id = 3090562190013347600 and scr.object_id = sc.object_id ) as ALOCATION
    from sc),
    cbloc as ( select
    (select value from nc_params sccid where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590) as CIRCUIT_ID,
    (select sl.name from nc_objects sl join nc_references scr on sl.object_id = scr.reference
    where scr.attr_id = 3090562190013347601 and scr.object_id = sc.object_id ) as BLOCATION
    from sc)
    select cid.CIRCUIT_ID,cid.DESCRIPTION,ALOCATION,BLOCATION from (
    cid
    join caloc on cid.CIRCUIT_ID = caloc.CIRCUIT_ID and ALOCATION is not null
    join cbloc on cid.CIRCUIT_ID = cbloc.CIRCUIT_ID and BLOCATION is not null
    it` returns and`s all ok!
    ID desc aloc bloc
    101     TEST1     AHAS     AGUS
    102     TEST2     AKRE     AMJY
    103     TEST3     AMJS     ASSE
    109     TEST9     BAIA     AKIB
    5     (null)     WELA AGUS
    We have "sc as (select * from nc_objects where object_type_id = 9122942307013185081 and project_id=9062345122013900768)"
    and identical subquery on caloc and cbloc
    "select value from nc_params sccid where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590"
    If i change query on
    with
    sc as (select * from nc_objects where object_type_id = 9122942307013185081 and project_id=9062345122013900768),
    cid as (select sccid.value AS CIRCUIT_ID,sc.description AS DESCRIPTION
    from sc, nc_params sccid
    where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590),
    caloc as ( select
    *(select CIRCUIT_ID from cid) as CIRCUIT_ID,*
    (select sl.name from nc_objects sl join nc_references scr on sl.object_id = scr.reference
    where scr.attr_id = 3090562190013347600 and scr.object_id = sc.object_id ) as ALOCATION
    from sc),
    cbloc as ( select
    (select value from nc_params sccid where sccid.object_id = sc.object_id and sccid.attr_id = 9122948792013185590) as CIRCUIT_ID,
    (select sl.name from nc_objects sl join nc_references scr on sl.object_id = scr.reference
    where scr.attr_id = 3090562190013347601 and scr.object_id = sc.object_id ) as BLOCATION
    from sc)
    select cid.CIRCUIT_ID,cid.DESCRIPTION,ALOCATION,BLOCATION from (
    cid
    join caloc on cid.CIRCUIT_ID = caloc.CIRCUIT_ID and ALOCATION is not null
    join cbloc on cid.CIRCUIT_ID = cbloc.CIRCUIT_ID and BLOCATION is not null
    query result will be:
    ORA-01427: single-row subquery returns more than one row
    01427. 00000 - "single-row subquery returns more than one row"
    *Cause:   
    *Action:
    Can you explain why so ?
    Edited by: user12031606 on 07.05.2010 2:31
    Edited by: user12031606 on 07.05.2010 2:32

    Hi,
    Welcome to the forum!
    Whenever you post code, format it to show the extent of sub-queries, and the clauses in each one.
    Type these 6 characters:
    \(all small letters, inside curly brackets) before and after each section of formatted test; if you don't, this site will compress the spaces.
    It also helps it you reduce your query as much as possible.  For example, I think you're only asking about the sub-query called caloc, so just post caloc as if that were the entire query:select     ( select CIRCUIT_ID
         from cid
         )                as CIRCUIT_ID,
         ( select sl.name
         from nc_objects          sl
         join nc_references      scr on sl.object_id = scr.reference
         where scr.attr_id      = 3090562190013347600
         and scr.object_id      = sc.object_id
         )                as ALOCATION
    from sc
    This makes it much cleared that the query will produce 2 columns, called circuit_id and alocation.
    Compare the query above with the query below:SELECT     object_id,
         'Okay'
    FROM     sc
    The basic structure is the same: both queries produce two columns, and both queries produce one row of output for every row that is in the sc table.
    The only difference is the two items in the SELECT clause.
    The second query has a column from the table as its first column, and a literal for its second column; those are just two of the kinds of things you can have in a SELECT clause.  another thing you can have there is a +Scalar Sub-Query+ , a complete query enclosed in parentheses that produces exactly one column and at most one row.   If a scalar sub-query produces more than one row, then you get the run-time error: "ORA-01427: single-row subquery returns more than one row", as you did.
    A scalar sub-query always takes the place of a single value: "scalar" means "having only one value".  In the first example above, the main query is supposed to produce one row of output for every row in sc.  How can it do that if some of the columns themselves contain multiple rows?
    I don't know what your tables are like, or what output yu want to get from thiose tables.
    If you'd like help getting certain results from your tables, then post CREATE TABLE and INSERT statements for a little sample data, and the resutls you want to get from that sample data.  A scalar sub-query may help getting those results, or it may not.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Naming.lookup() returns null???? Why??

    I read about this in a previous forum but there was no answer given to someones question about it. Sometimes Naming.lookup() returns null and a later call will succeed. Is there a recognised reason for this? Is it a recognised bug or undocumented feature?
    I have seen some sample RMI source on the Internet and sometimes the code checks for null and gives and error. The sample programs from Sun regarding RMI don't check for null.
    Has anyone ever encountered this and found a way around it?
    Thanks for you help,
    Anthony

    hi
    are you using an Activatable object??
    then, it can happens, since you won't have your object until the ActivationSytem is running.
    And it takes little time for the activation system to run.
    If u are using an 'Activatable object, i will suggest to write a loop in which you check if hte ActivationSystem was started.
    something like this
    boolean display = false;
    ActivationGroupID agi = null;
    while(true) {
    try {
    if(!display) {
    System.err.println("Trying to connect to ActivationSystem...");
    display = !display;
    agi = ActivationGroup.getSystem().registerGroup(exampleGroup);
    break;
    } catch(Exception e) {
    continue;
    }

  • How do I check for null parameters in  Process Validations?

    I am trying to create a Unit Test that validates that a record has been inserted into a table. However I am having problems when dealing with null parameters.
    I created a simple table and insert procedure:
    create table TEST_TAB (
    A varchar2 (30) not null,
    B varchar2 (30));
    create or replace procedure TEST_TAB_INS (P_A in varchar2, P_B in varchar2) is
    begin
    insert into TEST_TAB values (P_A, P_B);
    end;
    Then I created a Unit Test with two implementations:
    The first executes TEST_TAB_INS ('One', 'Two')
    The second executes TEST_TAB_INS ('One', null)
    I attached the following Query Returning Rows Process Validation to both implementations:
    select *
    from TEST_TAB
    where A = '{P_A}'
    and (B = '{P_B}' or '{P_B}' is null)
    This should allow for the case where P_B is null. However the second test fails with a "Query check returned no rows" error.
    I've tried altering the test to use nvl, but get the same results:
    select *
    from TEST_TAB
    where A = '{P_A}'
    and (B = '{P_B}' or nvl ('{P_B}', 'XXXX') = 'XXXX')
    However, the following test succeeds:
    select *
    from TEST_TAB
    where A = '{P_A}'
    and (B = '{P_B}' or nvl ('{P_B}', 'XXXX') = '{P_B}')
    Which suggests that null parameters are not being treated as nulls in Process Validations

    I've found a way to solve this. By changing the test to:
    select *
    from TEST_TAB
    where A = '{P_A}'
    and (B = '{P_B}' or '{P_B}' = 'NULL')
    I am able to get both to get both implementations to succeed.
    Edited by: AJMiller on Dec 28, 2012 4:24 AM

  • How to open a page from a Form and pass parameters to the form on that page

    I found a similar example on this forum, but it did not work for me:
    declare
    l_names owa.vc_arr;
    l_values owa.vc_arr;
    i number;
    begin
    PORTAL.wwpro_api_parameters.retrieve(l_names, l_values);
    FOR i in 1..l_names.count
    LOOP
    htp.p(l_names(i) || ' ' || l_values(i));
    END LOOP;
    end;
    By using this method i get the parameters for the Form, like the session ID, but not the parameters for the Page that the form is displayed in.
    Another method I tried:
    To open a Form from a Form and pass parameters works fine like this:
    --In the After processing page PL/SQL event.
    declare
    v_id number;
    blk varchar2(10):='DEFAULT';
    Begin
    v_id:=p_session.get_value_as_number (p_block_name=&gt;blk,p_attribute_name=&gt;'A_ID');
    if v_id &gt; 0 then
    htp.formOpen('PORTAL.wwa_app_module.link?p_arg_names=_moduleid&p_arg_values=2649500412&p_arg_names=_show_header&p_arg_values=YES&p_arg_names=ID&p_arg_values='||to_char(v_id),'post');
    htp.formSubmit(NULL,'Upload Files');
    htp.formClose;
    end if;
    End;
    But I want to open a Page containing the Form instead of just opening the Form. Is this possible to open a Page and pass paramters to the page, and then let the form inside the Page access the passed paramters. The reason for this is that a Form cannot be based on a page template, or can it? When opening the form i want to keep the left menu, which I can if it is a page based on my template with the left menu.
    Best regards
    Halvor

    Hi,
    You can do this by calling the url of the page with the form. You can then use p_arg_names and p_arg_values to pass parameters. In the called form you can get the value from p_arg_names and p_arg_values and assign it to the form field.
    You can call this code in the success procedure of the calling form.
    declare
    v_id number;
    blk varchar2(10):='DEFAULT';
    v_url varchar2(2000);
    Begin
    v_id:=p_session.get_value_as_number (p_block_name=>blk,p_attribute_name=>'A_ID');
    v_url := <page_url>;
    if v_id > 0 then
    call(v_url||'&p_arg_names=id&p_arg_values='||v_id);
    end if;
    End;
    In the called form in "Before displaying form" plsql section write this code.
    for i in 1..p_arg_names.count loop
    if p_arg_names(i) = 'id' then
    p_session.set_value(
    p_block_name => blk,
    p_attribute_name => 'A_ID',
    p_value => p_arg_values(i)
    end if;
    end loop;
    This code picks up the value from p_arg_values and assigns it to the form field.
    Hope that helps.
    Thanks,
    Sharmila

  • Deployment error - Errors in named queries in weblogic 10

    Hi, All.
    I got the error message when I tried to deploy my webapp to weblogic 10 & 10.1(10M1).
    Stacktrace:
    <May 19, 2008 11:51:14 AM EDT> <Error> <Console> <BEA-240003> <Console encounter
    ed the following error weblogic.application.ModuleException:
    at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:314)
    at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedM
    oduleDriver.java:176)
    at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(Modu
    leListenerInvoker.java:93)
    at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(Depl
    oymentCallbackFlow.java:360)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
    river.java:26)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(Dep
    loymentCallbackFlow.java:56)
    at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(Dep
    loymentCallbackFlow.java:46)
    at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.ja
    va:615)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineD
    river.java:26)
    at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.j
    ava:191)
    at weblogic.application.internal.DeploymentStateChecker.prepare(Deployme
    ntStateChecker.java:147)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(App
    ContainerInvoker.java:61)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.cr
    eateAndPrepareContainer(ActivateOperation.java:189)
    at weblogic.deploy.internal.targetserver.operations.ActivateOperation.do
    Prepare(ActivateOperation.java:87)
    at weblogic.deploy.internal.targetserver.operations.AbstractOperation.pr
    epare(AbstractOperation.java:217)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploym
    entPrepare(DeploymentManager.java:719)
    at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploy
    mentList(DeploymentManager.java:1186)
    at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare
    (DeploymentManager.java:248)
    at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.pre
    pare(DeploymentServiceDispatcher.java:157)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
    ackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:157)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
    ackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:12)
    at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallb
    ackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:45)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTunin
    gWorkManagerImpl.java:464)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
    Caused by: java.lang.Throwable: Substituted for missing class org.hibernate.Hibe
    rnateException - Errors in named queries: SpotType.findById, Spot.findByTopic, T
    argetAudience.findById, SpotOrder.findById, SpotAuditDetails.findById, ProjectOf
    ficer.findById, SpotOrderAvailable.findById, ProjectOfficer.findByStatus, SpotOr
    derTopic.findById, Topic.findById, findAllSpots, SpotOrderDetails.findById, find
    AllCategory, SME.findById, SpotAudit.findById, ContactInfo.findById, SpotCategor
    y.findById, SpotOrderTopicSpot.findById, ProjectTopic.findById, NetworkType.find
    ById, Source.findById, NetworkType.findByStatus, RecordStatus.findById, SpotType
    .findByStatus, findAllClient, Spot.findByTitle, findAllRecordStatus, SMETopicCom
    ments.findById, ContractInfo.findById, Channel.findById, Client.findById, findAl
    lSource, SMETopic.findById, Project.findById, SpotComments.findById, SpotOrderCo
    mments.findById, ContactInfoComments.findById, Spot.findById
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:
    365)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
    a:1300)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(Annotat
    ionConfiguration.java:859)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
    figuration.java:669)
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFa
    ctory(HibernatePersistence.java:132)
    at weblogic.deployment.PersistenceUnitInfoImpl.createEntityManagerFactor
    y(PersistenceUnitInfoImpl.java:264)
    at weblogic.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInf
    oImpl.java:110)
    at weblogic.deployment.AbstractPersistenceUnitRegistry.storeDescriptors(
    AbstractPersistenceUnitRegistry.java:316)
    at weblogic.deployment.AbstractPersistenceUnitRegistry.loadPersistenceDe
    scriptors(AbstractPersistenceUnitRegistry.java:96)
    at weblogic.deployment.ModulePersistenceUnitRegistry.<init>(ModulePersis
    tenceUnitRegistry.java:53)
    at weblogic.servlet.internal.WebAppModule.initPURegistry(WebAppModule.ja
    va:1151)
    at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:304)
    >
    I included named queries on orm.xml file and also in each entities using annotations like following.
    orm.xml>
    <?xml version="1.0" encoding="UTF-8"?>
    <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
         version="1.0">
         <!-- WE PLACE LARGER AND JOIN QUERIES STATEMENTS HERE -->
         <named-query name="findAllClient">
    <query><![CDATA[SELECT e FROM Client e ORDER BY e.clientName]]></query>
    </named-query>
    <named-query name="findAllSource">
    <query><![CDATA[SELECT e FROM Source e ORDER BY e.sourceDesc]]></query>
    </named-query>
    <named-query name="findAllCategory">
    <query><![CDATA[SELECT e FROM SpotCategory e ORDER BY e.spotCategoryDesc]]></query>
    </named-query>
    <named-query name="findAllRecordStatus">
    <query><![CDATA[SELECT e FROM RecordStatus e ORDER BY e.id]]></query>
    </named-query>
    <named-query name="findAllSpots">
    <query><![CDATA[SELECT e FROM Spot e ORDER BY e.id]]></query>
    </named-query>
    </entity-mappings>
    entity example:
    @Entity
    @Table(name = "SPOTTYPE")
    @NamedQueries( { @NamedQuery(name = "SpotType.findById", query = "SELECT e FROM SpotType e WHERE e.id = :id"),
         @NamedQuery(name = "SpotType.findByStatus", query = "SELECT e FROM SpotType e WHERE e.recordStatus.id = :status") })
    public class SpotType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(generator = "spotTypeSeq")
    @SequenceGenerator(name = "spotTypeSeq", sequenceName = "SEQ_SPOTTYPE", allocationSize = 1)
    @Column(name = "SPOTTYPEID", nullable = false, length = 2)
    private Long id;
    @Column(name = "SPOTTYPESHRTNM", nullable = false, length = 2)
    private String spotTypeShortName;
    @Column(name = "SPOTTYPELONGNM", nullable = false, length = 35)
    everything works until I clicked the activate the change button. I tried to override libs by putting libs I'm using in my domain, still I have the same error message.
    Libs that I have:
    Name 5 Size Type Date Modified
    antlr-2.7.6.jar 434 KB ALZip jar File 2/13/2008 5:28 PM
    asm.jar 26 KB ALZip jar File 2/13/2008 5:28 PM
    asm-attrs.jar 17 KB ALZip jar File 3/17/2005 4:05 PM
    cglib-2.1.3.jar 276 KB ALZip jar File 2/13/2008 5:28 PM
    commons-beanutils-1.7.0.jar 185 KB ALZip jar File 12/15/2007 7:12 PM
    commons-codec-1.3.jar 46 KB ALZip jar File 12/15/2007 7:12 PM
    commons-collections-3.1.jar 547 KB ALZip jar File 4/24/2008 10:28 AM
    commons-digester-1.8.jar 141 KB ALZip jar File 12/15/2007 7:13 PM
    commons-discovery-0.4.jar 75 KB ALZip jar File 12/15/2007 9:08 PM
    commons-el-1.0.jar 110 KB ALZip jar File 5/15/2008 1:11 PM
    commons-logging-1.0.4.jar 38 KB ALZip jar File 7/4/2004 4:49 AM
    dom4j-1.6.1.jar 307 KB ALZip jar File 2/13/2008 5:28 PM
    ehcache-1.2.jar 116 KB ALZip jar File 2/13/2008 5:28 PM
    ejb3-persistence.jar 52 KB ALZip jar File 3/14/2008 4:45 PM
    hibernate3.jar 2,222 KB ALZip jar File 2/6/2008 9:31 PM
    hibernate-annotations.jar 274 KB ALZip jar File 3/14/2008 4:44 PM
    hibernate-commons-annotatio... 65 KB ALZip jar File 3/14/2008 4:45 PM
    hibernate-entitymanager.jar 116 KB ALZip jar File 3/14/2008 8:07 PM
    jaas.jar 102 KB ALZip jar File 6/3/2004 11:31 AM
    javassist.jar 449 KB ALZip jar File 2/13/2008 5:28 PM
    jaxen-1.1-beta-7.jar 222 KB ALZip jar File 8/16/2005 2:04 PM
    jboss-archive-browsing.jar 13 KB ALZip jar File 2/13/2008 5:28 PM
    jhighlight-1.0.jar 92 KB ALZip jar File 12/20/2007 4:51 PM
    jsf-facelets.jar 294 KB ALZip jar File 9/27/2007 12:20 PM
    jstl-1.2.jar 405 KB ALZip jar File 5/15/2008 1:12 PM
    jta.jar 9 KB ALZip jar File 6/3/2004 11:31 AM
    junit-4.4.jar 158 KB ALZip jar File 5/15/2008 1:12 PM
    log4j-1.2.11.jar 343 KB ALZip jar File 8/13/2005 3:28 PM
    myfaces-api-1.2.2.jar 319 KB ALZip jar File 1/22/2008 3:40 PM
    myfaces-impl-1.2.2.jar 739 KB ALZip jar File 1/22/2008 3:40 PM
    nekohtml-0.9.5.jar 104 KB ALZip jar File 12/20/2007 4:42 PM
    ojdbc14.jar 1,322 KB ALZip jar File 2/13/2008 5:30 PM
    readme.txt 1 KB Text Document 5/15/2008 3:58 PM
    richfaces-api-3.2.0.GA.jar 150 KB ALZip jar File 3/31/2008 4:23 PM
    richfaces-impl-3.2.0.GA.jar 1,372 KB ALZip jar File 3/31/2008 4:23 PM
    richfaces-ui-3.2.0.GA.jar 2,215 KB ALZip jar File 3/31/2008 4:50 PM
    spring.jar 2,604 KB ALZip jar File 5/15/2008 1:12 PM
    xerces-2.6.2.jar 988 KB ALZip jar File 12/19/2004 6:14 PM
    xml-apis.jar 121 KB ALZip jar File 6/3/2004 11:31 AM
    This can be deployed to tomcat 6 without any problems.
    Thank you in advance for reading and your help.
    Edited by gzson at 05/19/2008 9:07 AM

    Follow the below link:
    http://www.hibernate.org/250.html#A25

  • How to pass parameter to the Query String of the Named Queries'SQL

    Firstly to say sorry,I'm a beginner and my English is very little.
    Now I want to know
    How to pass parameter to the Query String of the Named Queries'SQL in the Map editor.
    Thanks.

    benzi,
    Not sure if this is on target for your question, but see #5 in the link below for some web screencasts that show how to pass an input text form field value to the bind variable of a view object. If you're looking for something different, maybe provide some more details such as what you are trying to accomplish and what technology stack you are using - for example, ADF BC, JSF, etc.
    http://radio.weblogs.com/0118231/stories/2005/06/24/jdeveloperAdfScreencasts.html
    Also see section 5.9 and chapter 18 in the developer's guide.
    thanks

  • OAS 10G WAR file deployment error (Errors in named queries)

    Hi again,
    I setup a 10G 10.1.3.1 Application Server and tried deploying my WAR file. In tomcat the WAR file deployment works fine. however in OAS I get this error and currently I'm clueless as to what causes the error.
    [Oct 24, 2007 6:03:37 PM] Operation failed with error: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: Errors in named queries: Book_List_By_RegisterDate ... (other named queries)
    My ApplicationContext.xml file contains this
    <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceUnitManager" ref="persistenceUnitManager" />
    <property name="persistenceUnitName" value="BookStudy" />
    <property name="dataSource" ref="dataSource" />
    <property name="jpaVendorAdapter">
    <bean
    class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    <property name="database" value="ORACLE" />
    <property name="showSql" value="true" />
    </bean>
    </property>
    </bean>
    And a sample named query in the hbm.xml file is this
    <query name="Book_List_By_RegisterDate">
              from BookData
              where to_char(regdate, 'MM/dd/yyyy') = to_char(:regdate, 'MM/dd/yyyy')
              order by Author.author_name desc, bookname desc
    </query>
    Thanks,

    Uncomment, or add, the following line in your application's orion-web.xml file:
    <web-app-class-loader search-local-classes-first="true" include-war-manifest-class-path="true" />
    See njr28's comments @ http://forum.hibernate.org/viewtopic.php?t=951324&highlight=oc4j

  • Named Queries in Toplink

    Help
    This is doing my head in.
    I have created a named query, its simple, it gets an employee from the database with the matching employeeid... the parameter is "id".
    Once I created the named query I dragged the Employee class to the Data Control Palette and it shows my TopLink names query, i selected Return and put it on a page... now how on earth do i get the ID parameter into the named query and get it to display on the screen.
    Please please help its driving me nuts
    Thank you in advanced
    Rory

    thank you SO VERY MUCH.
    I looked everywhere for that tiny thing... I had gotten everything except how to get the parameter into the method.
    Evetually I did an overide on the "initializeMethodParameters" method on the DataAction and set the parameters that way, but this works much better.
    I will make sure i watch the forums closely so i can pass this on.
    Thank you once again
    Rory

Maybe you are looking for