Named query, primary keys must not contain null

We have an question on the named query. Here is the scenario:
Class JoinClassC (id, name, desc, comment) is mapped to two tables Join_Table_A (id, name, description) and Join_Table_B (id, name, comments); Join_Table_A is the primary table; two tables are associated via primary key.
Defined a named query (findByName, ReadAllQuery/SQL) for JoinClassC descriptor. The sql is:
SELECT a.ID,a.NAME,a.DESCRIPTION,b.COMMENTS FROM JOIN_TABLE_A a, JOIN_TABLE_B b WHERE a.NAME=#name AND a.ID=b.ID AND a.NAME=b.NAME
Getting QueryException while executing the query. Here is the trace:
[3/2/05 13:50:24:795 EST] f8b62aa SystemOut O 2005.03.02 01:50:24.795--ServerSession(738697921)--Thread[Servlet.Engine.Transports : 4,5,main]--Connection(1095574161)--SELECT a.ID,a.NAME,a.DESCRIPTION,b.COMMENTS FROM JOIN_TABLE_A a, JOIN_TABLE_B b WHERE a.NAME='persistence' AND a.ID=b.ID AND a.NAME=b.NAME
2005.03.02 01:50:24.835--ClientSession(1127670417)--Thread[Servlet.Engine.Transports : 4,5,main]--Exception [TOPLINK-6044] (OracleAS TopLink - 10g (9.0.4.4) (Build 040627)): oracle.toplink.exceptions.QueryException
Exception Description: The primary key read from the row [DatabaseRow(
     USER04.JOIN_TABLE_B.ID => 2
     USER04.JOIN_TABLE_A.NAME => persistence
     USER04.JOIN_TABLE_A.DESCRIPTION => FJF Persistence Fram
     USER04.JOIN_TABLE_B.COMMENTS => The Persistence Fram)] during the execution of the query was detected to be null. Primary keys must not contain null.
Query: ReadAllQuery(com.ford.it.persistence.unittest.dom.JoinClassC)Local Exception Stack:
Exception [TOPLINK-6044] (OracleAS TopLink - 10g (9.0.4.4) (Build 040627)): oracle.toplink.exceptions.QueryException
Exception Description: The primary key read from the row [DatabaseRow(
     USER04.JOIN_TABLE_B.ID => 2
     USER04.JOIN_TABLE_A.NAME => persistence
     USER04.JOIN_TABLE_A.DESCRIPTION => FJF Persistence Fram
     USER04.JOIN_TABLE_B.COMMENTS => The Persistence Fram)] during the execution of the query was detected to be null. Primary keys must not contain null.
Query: ReadAllQuery(com.ford.it.persistence.unittest.dom.JoinClassC)
     at oracle.toplink.exceptions.QueryException.nullPrimaryKeyInBuildingObject(QueryException.java:542)
Adding b.ID to the sql select will solve the problem.
Question: does the primary key must be present in the sql select to run this kind of query? Any way to work around the restriction?
Your help would be greatly appreciated.
Haiwei

The problem is that you need to select both primary keys for the multiple table descriptor.
i.e.
SELECT a.ID,a.NAME,a.DESCRIPTION,b.ID, b.COMMENTS FROM JOIN_TABLE_A a, JOIN_TABLE_B b WHERE a.NAME=#name AND a.ID=b.ID AND a.NAME=b.NAME
Your SQL needs to return the same data that TopLink would have selected, which includes the primary key for both tables. TopLink expects both a.ID and b.ID fields in the select, because your only select one and the field names are the same TopLink thought the ID field was for b.ID not a.ID, if you select both it will be ok.

Similar Messages

  • Null in Composite Primary Key and "Primary keys must not contain null"

    Hello all.
    I'm a newbie concerning to JPA/EJB3, but I was wondering if toplinks doesn't support composite primary keys with null in some field (something perfectly right in any RDBMS).
    I used JDeveloper (I'm using Oracle 10g database and JDeveloper 10.1.3.2.) wizards to generate JPA classes and I checked out generated files (with annotations), so they should be right (by the way, other O-R mappings for my model are working right, but this one).
    I'm getting the next error:
    Exception Description: The primary key read from the row [DatabaseRecord(
         TSUBGRUPOSLDI.CD_GRUP => 01
         TSUBGRUPOSLDI.CD_SUBGRUP => null
         TSUBGRUPOSLDI.CG_POBL => 058
         TSUBGRUPOSLDI.CG_PROV => 28
         TSUBGRUPOSLDI.DSCR => Sanidad)] during the execution of the query was detected to be null. Primary keys must not contain null.
    Compound primary key is (CD_GRUP, CD_SUBGRUP). No foreign keys, no joins (only a NamedQuery: "select o from ..."). It's the simplest case!
    I checked out that everything runs ok if there's no "null" value in CD_SUBGRUP.
    After some research (this and other forums) I'm beginning to believe that it's not supported, but not sure.
    Am I doing sth wrong? If not, what is the reason to not support this? Will it be supported in the future?
    Thanks in advance.

    Null is a special value and in many databases is not comparable to another null value (hence the isNull operator) and may pose problems when used to uniquely identify an Entity. TopLink does not support null values within a composite PK. As the nullable column is most likely not designated as a PK within your database table (many databases do not allow this) I recommend updating the Entity PKs to match that of the database.
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Values in a DynamicConfiguration must not be null

    In File to RFC to File synchronous method without BPM , i need to populate the file name for the receiver file dynamically.
    So i have used UDF in RFC to File message mapping.
    Z_RFC                                               MT_RCV_FILE
    FILENAME                                          FILENAME
    ITAB_OUT----
    ITAB_OUT
       item        -
    item
          STR1   -
    STR
    Created a  UDF for FILENAME as below:
    FILENAME -
    > UDF -
    > FILENAME
    and coded as below:
    try{
    String FILENAME  =  " ";
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FILENAME");
    FILENAME = conf.get(key);
    conf.put(key, FILENAME);
    return FILENAME;
    catch(Exception e)
         String exception = e.toString();
          return exception;
    when i test the mapping it shows an error :java.lang.NullPointerException
    and while doing a full test it shows :
    java.lang.IllegalArgumentException: Values in a DynamicConfiguration must not be null in SXMB_MONI
    can anybody guide me to solve this error.

    Hi Abhisek,
    I have changed it to FileName and when i do a end-to-end testing it shows
    Error: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'java.lang.Exception: Consistency error: more fields found in XML structure than specified in conversion parameters! (Value '20000000Test2222222220      Pass1')', probably configuration error in file adapter (XML parser error)'
    The strucute of receiver File:
    MT_RCV_FILE
         FILENAME          0 .....1
        ITAB_OUT           0......1
                  item            0.....unbounded
                      STR1      0......1
    In the  receiver CC i have given the following parameters:
    Target directory : /home/ftpusr/test/out
    File name scheme : *
    Content Conversion
    ITAB_OUT.fieldFixedLengths  30,255
    ITAB_OUT.endSeparator : 'nl'
    item.addHeaderLine  : 0
    item.fieldFixedLengths : 255
    item.endSeparator : 'nl'
    where could be the problem?

  • Theme editor doesn't show - DesignManager must not be null error

    Hi,
    I'm experiencing problem with Theme Editor & default portal themes. Problem was probably started by importing custom themes from older version of portal (current configuration is NW2004 SPS19, Java stack). After entering System Administration / Portal Display, theme editor doesn't show up and defaulttrace contains following error:
    #1#java.lang.IllegalArgumentException: DesignManager must not be null.
         at com.sapportals.portal.ssd.userInterface.InitialPage.<init>(InitialPage.java:74)
         at com.sapportals.portal.ssd.StyleSheetDesigner.doContent(StyleSheetDesigner.java:94)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
         at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
         at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
         at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
         at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
         at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
         at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:545)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    I've tried many things - delete custom themes (at first from Theme Archive, then from themes Integrity browser (...irj/servlet/prt/portal/prtroot/com.sap.portal.themes.integrity.browse) and finally I've found traces in the filesystem (I think it was .../irj/root/portalapps/com.sap.portal.design.urdesigndata/themes/customer)). So there should be no trace of custom themes in the system (as suggested in thread Theme Editor no showing content.), but the problem remains.
    And there's more I found. We have 2 same systems installed on one server (both have own Oracle database+NW 2004 SPS19). The other portal works fine and without any problems, even with the same themes imported - it didn't create any error so I wonder if the problem doesn't lie somewhere else.
    One more thing I noticed, which is different among these two portals, is the bahaviour of default themes - when I start ...irj/servlet/prt/portal/prtroot/com.sap.portal.themes.integrity.browse on both portals, the one which works, has also its and portal subnodes under every theme from SAP. On the other portal, only one theme shows all - the sap_chrome. Other themes contain only ur subnode. I've tried to compare filesystems of both portals (but only directries which I found through search for "sap_tradeshow"), but I haven't noticed any differences. What else could be different?
    I tried many things, but without any effect. Could anyone help me, please? I'm running out of ideas and thinking about reinstalling the portal, which isn't prefereble solution.

    Hi,
    It's really hard to say, where's the problem. I think you should reinstall it..., probably some components of your EP wasn't installed correctly.
    Regards,
    Juraj

  • PRIMARY KEY must be unique

    We tried to deploy with a JSP page and the following Errors appeared in log:
    [5400:4968:0613/153602:ERROR:connection.cc(733)] sqlite error 19, errno -2: PRIMARY KEY must be unique
    [5400:3224:0613/153603:ERROR:external_registry_loader_win.cc(90)] Missing value path for key Software\Google\Chrome\Extensions\jfmjfhklogoienhpfnppmbcbjfjnkonk.
    [5400:2964:0613/153607:ERROR:textfield.h(162)] NOT IMPLEMENTED
    Please guide us how to solve the issue.
    Thanks in advance,

    Which Jdev version do you use?
    11G Release 2
    11.1.2.2.0
    What kind of application  using which technology you are building?
    simplest one: Hello TimoHahn
    Which db do you use?
    Not yet use any DB
    Answered all your questions, Timo!
    How could we get a EAR file with " Hello World" out put?

  • Unexpected error;Primary key does not exist:CmscdomPK version=2,name=J2E

    Hi I am getting the following error when i try to access the CMS related WebDynpro application.
    First time i am able to access the CMS.I created the domain and track.after that i edited the Domain tab with new domain name J2E.During that time i tried to save the domain,its throughing the Primary key does n't exist error.I closed the application.Again when i tried to access the CMS.Its throughing the following error.
    <b>Error stacktrace:
    com.sap.tc.webdynpro.progmodel.controller.MessageManager$AbortMessageManagerException: Unexpected error; inform your system administrator - Primary key does not exist: CmscdomPK version=2,name=J2E
         at com.sap.tc.webdynpro.progmodel.controller.MessageManager.raiseMessageInternal(MessageManager.java:254)
         at com.sap.tc.webdynpro.progmodel.controller.MessageManager.raiseMessage(MessageManager.java:964)
         at com.sap.cms.ui.wl.Custom1.hasTracks(Custom1.java:860)
         at com.sap.cms.ui.wl.Custom1.wdDoInit(Custom1.java:277)
         at com.sap.cms.ui.wl.wdp.InternalCustom1.wdDoInit(InternalCustom1.java:990)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingCustomController.doInit(DelegatingCustomController.java:73)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
         at com.sap.tc.webdynpro.progmodel.controller.Component.getCustomControllerInternal(Component.java:436)
         at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:374)
         at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:403)
         at com.sap.tc.webdynpro.progmodel.context.AttributeInfo.initAttributeMapping(AttributeInfo.java:596)
         at com.sap.tc.webdynpro.progmodel.context.AttributeInfo.init(AttributeInfo.java:456)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.initAttributes(NodeInfo.java:771)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:756)
         at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:40)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:540)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bind(ViewManager.java:398)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:555)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:422)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)
         at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:134)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:373)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:608)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
         at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:252)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:392)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)</b>
    What causing the problem.I am not finding the way,where can i rectifything problem
    Regards
    Usman

    Hi Usman,
    Domain ID and CMS Server ID are also stored in the SLD when you create these for the first time. As of now you can just create one Domain and One CMS Server id.
    If you have to edit it you may have to do the following.
    1. Delete all the tracks under the domain id and the CMS server id.
    2. Then in SLD. go to HOME -> CONTENT BROWSER -> SUBSET = LANDSCAPE DESCRIPTION
    In the CLASS dropdown please select Change Management Domain. Select the domain that you had created and delete it.
    Again in the CLASS dropdown select Change management Server. Select it and delete.
    Note: Please ensure that all the tracks have been deleted before you delete SLD entries.
    Now login to CMS again and create the Domain and CMS server again.
    If possible please try this some where on a test machine if possible and then try in actual scenario.
    Hope this helps.
    Regards
    Sidharth

  • Visual Web ICEfaces - 'library must not be null' error

    Hi Everyone...
    I installed the following plugins 'ICEfaces Run-Time Libraries' and 'VisualWeb ICEfaces'. I restarted the IDE and went on to create a 'Web Application'. I selected 'Visual Web ICEfaces' in the famework option and clicked on 'finish'. As the progress bar hits 75%, I am getting a message that says 'library must not be null' and there is no further progress beyond 75%. When I click on the 'library' tab, I can see 'ICEfaces Run-Time 1.8.2', so I dont understand why I am getting a 'library must not be null' error. Any idea why I am getting this?
    OS: WinXP Professional
    IDE: Netbeans 6.5.1

    any clues anyone?

  • Create Policy Resource Exception. Resource type must not be null

    OAM version: 11.1.1.5
    I have installed OAM 11g webgate but not able to register it from OAM admin console. It is throwing the error "Create Policy Resource Exception. Resource type must not be null" whenever I try to register the agent.
    Also I don't see any resource types like Http,Tokenservice and wl_Authen in Resource Type link of OAM Admin console.
    How to add these missing resource types in OAM 11g?
    Thanks in Advance

    Hi
    I didn't find solution for this issue. As I got this error in my VM machine, I reverted my snapshot to "After installing WLS" and then I installed and configured OAM again. This time I didn't get the issue.
    Good Luck.

  • The value must not be NULL

    Post Author: rene.marxis
    CA Forum: Charts and Graphs
    copied from .Net-forum *** Hello we have one strange problem on one client where we use crystal reports.We have one application written in C# in VS2005 where we use some reports to that embed graphics generated from ZedGraph.The application works very fine on all clients except one.The
    report is prety simple. There are only 3 image items on the detail
    section and we pass the image data as a byte&#91;&#93; array to the report
    inside our dataset. For every image on the report we get the following
    error:"Crysytal Report Windows Forms Viewer"-"Der Wert darf nicht NULL sein.Parametername:path1"Which means "The value must not be NULL. Parametername: path1" We get the same errormessage for every image on the report.We
    allready checked the data inside the dataset and it is filled of course
    (also the same report works with the same data on other clients).Also other reports work fine on that client. Olny the once where image-data is passed from code is not working.  Here is some additional data:OS: Windows XP ProfessionalCR-Files from: CrystalReportsRedist2005_x86.msm (27. Januar 2006)Language  C# VS2005 Setup-Type: Install-Shield 12 (CR via merge-module) Here is some democode that produces the error (sorry i don't have permission to upload the project...)            ZedGraph.ZedGraphControl zgc = new ZedGraphControl();            zgc.Size = new Size(950, 500);            CreateChart(zgc);            Bitmap bmp;            MemoryStream ms;                        bmp = zgc.GraphPane.GetImage();                        ms = new MemoryStream();                        bmp.Save(ms, ImageFormat.Bmp);                        byte&#91;&#93; myImg = ms.GetBuffer();            ms.Close();            dsImage1.DataTable1.Rows.Add(myImg);            MessageBox.Show("Len of image in DS:" + ((byte&#91;&#93;)dsImage1.DataTable1.Rows&#91;0&#93;&#91;"Img"&#93;).Length);            rpt.SetDataSource(dsImage1);    //here comes the error            crystalReportViewer1.ReportSource = rpt; The dataset consists of oly on Img tag. Any suggestions? Thanks in advance rene.

    Hi,
    CL_MAPPING_XMS_PLSRV3-ENTER_PLSRV Interface Mapping http://hsbc.com
    IM_PAYEXT_PEXR2002_To_PEXR2002_BPM The value for the input paramter
    DIRECTORYNAME must not be null
    This is your error...make sure that when the mapping IM_PAYEXT_PEXR2002_To_PEXR2002_BPM is executed the element DIRECTORYNAME is present and is always containin some value...sort of mandatory field.
    Regards,
    Abhishek.

  • How to improve performance of select query when primary key is not referred

    Hi,
    There is a select query where we are unable to refrence primary key of the tables:
    Since, the the below code is refrensing to vgbel and vgpos fields instead of vbeln and posnr..... the performance is very  slow.
    select vbeln posnr into (wa-vbeln1, wa-posnr1)             
           from lips                                            
           where ( pstyv ne 'ZBAT'    
               and pstyv ne 'ZNLN' )  
               and vgbel = i_vbap-vbeln                         
               and vgpos = i_vbap-posnr.                        
    endselect.                                                 
    Please le t me know if you have some tips..

    hi,
    I hope you are using the select statement inside a loop ...endloop get that outside to improve the performance ..
    if not i_vbap[] is initial.
    select vbeln posnr into table it_lips
    from lips
    for all entries in  i_vbap
    where ( pstyv ne 'ZBAT'
    and pstyv ne 'ZNLN' )
    and vgbel = i_vbap-vbeln
    and vgpos = i_vbap-posnr.
    endif.

  • Very Common Scenario - Insert new Rows whose primary Key is not in View Obj

    Question : How can you add new records when the primary key of the records are not present in view ? I am facing infinite loop for the below logic .
    The View Object is derived from 2 entity object (tableA,tableB) . The view has created in such a way that tableA data is updatable and tableB is read only. The view contains all the unique records of tableA and tableB . i,e the SQL query returns all the existing records from tableA , and those are not in tableA picks from tableB . Therefore , the Sql Query returns the primary key of tableA as 0 for the records which are not present in tableA but exist in tableB .
    there fore My sql qery like below
    select A.P_ID, A.mapping_id, A.dataValue FROM tableA A
    UNION select  0 P_ID ,  B.mapping_id , 0 dataValue From tableB  B ;
    Now my challenge is how can to add those new records that taken from table B and insert to TableA ? I am getting an infinite loop for the below logic -
    Below code has been written in my Managed bean -
    public void addNewSelectedMappings(){
    DCBindingContainer dcb = (DCBindingContainer)evaluateEL("#{bindings}");
    DCIteratorBinding dciter =
    dcb.findIteratorBinding("CustomView1Iterator");
    ViewObject vo = dciter.getViewObject();
    Row row = null;
    while ((row = vo.getCurrentRow()) != null)
    Number mappingId =
    (oracle.jbo.domain.Number)row.getAttribute("mappingId");
    java.lang.Number dataValue = ( java.lang.Number)row.getAttribute("dataValue ");
    if(mappingId .equals(0)){
    BindingContext bindingContext = BindingContext.getCurrent();
    BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
    // call the client interface defined in the AM
    OperationBinding methodWithArgs = (OperationBinding) bindings.get("insertNewRow");
    //add argument
    methodWithArgs.getParamsMap().put("mappingId",mappingId);
    methodWithArgs.getParamsMap().put("dataValue ",dataValue);
    methodWithArgs.execute();
    vo.next();
    Below code in my application module to execute -
    +public String insertNewRow(oracle.jbo.domain.Number mappingId , java.lang.Number  dataValue){+
    +try{+
    SequenceImpl seq = new SequenceImpl("TableA_ID_SEQ", getDBTransaction());
    oracle.jbo.domain.Number  seqNextval = seq.getSequenceNumber();
    System.out.println(" seqNextval " seqNextval);+
    ViewObject vo = this.getCustomView1();
    Row r = vo.createRow();
    r.setAttribute("P_Id", seqNextval);*
    r.setAttribute("mappingId ", mappingId );
    r.setAttribute("dataValue", dataValue);
    vo.insertRow(r);
    this.getDBTransaction().commit();
    +} catch (oracle.jbo.TooManyObjectsException tmoe) {+
    System.out.println(" eorrr......"tmoe);+
    return "error";
    +} catch ( RowAlreadyDeletedException rd) {+
    System.out.println(" Inside RowAlreadyDeletedException ");
    return "RowAlreadyDeletedException";
    +}+
    return "success";
    +}+

    Hi ,
    Can some one please help me out . Just to simplify the question , I have a mappings table and a Master table .
    All the user selected items should save in the Mapping table . let say , there is a table name Products . User selects the products and that should save in the User product mapping table .
    I want to show the user selected products and available products in a single view . also , want to update the mappings table based on user selection .
    i m using jdev 11.1.1.5 .

  • Value string (primary key) could not pass to entity bean

    database server 3.23.57
    application server Jboss 3.07
    ide jbuilder8
    i am using session bean to wrap entity bean where it calls for entity bean to lookup the databse.
    value entered in client application could not be passed from session bean to entity bean.
    it is a jtextfield thta capture string as input which is the customer id. it is also the primary key. session bean managed to get the value but it was then became null when i pass to entity bean.
    may i know wat could be the problem that is causing this?
    application server not suporting this feature???? or it is th elogic problem .. or i have miss ot some code somewhere.?

    Sounds like a code problem.

  • Bad exec plan when joining tables using primary keys together w/ Contains

    Hello all...this is something that confuzzles me....
    When joining 2 tables, the exec plan shows that the domain index is first accessed, before checking if there is a record in the other table using a highly selective index.
    create table users
    (userid varchar2(20),
    name varchar2(100),
    resume clob
    create table seeker
    (seekerid varchar2(20),
    userid varchar2(20),
    jobid varchar2(20)
    create index user_idx on users(userid)
    create index job_resume_index on users(resume)
    indextype is ctxsys.context
    create unique index seeker_unik on seeker(seekerid)
    create index seeker_index on seeker(jobid,userid)
    then sample records where inserted, then the text index was sync'ed.
    Query and Execution Plan:
    select u.userid, u.name
    from users u, seeker s
    where s.jobid = 'HJOBP000000000218627'
    and u.userid = s.userid
    and contains(resume,'texas') > 1
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=3 Card=1 Bytes=72)
    1 0 NESTED LOOPS (Cost=3 Card=1 Bytes=72)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'USERS' (Cost=2 Card=1
    Bytes=30)
    3 2 DOMAIN INDEX OF 'JOB_RESUME_INDEX' (Cost=0)
    4 1 INDEX (RANGE SCAN) OF 'SEEKER_INDEX' (NON-UNIQUE) (Cost=
    1 Card=1 Bytes=42)
    The problem with execution plan is if the domain index returns huge number of records i.e. 40k rows, then it has to check each userid with the SEEKER table, and returns only 10 rows. I can add a hint to specify the use of the user_idx instead of the domain index to improve performance.
    My question is how does the database determine when to use the domain index or to use other highly selective index with out the aid of a HINT. The trace file shows the use of "CTXSYS"."TEXTOPTSTATS".ODCIStatsIndexCost and "CTXSYS"."TEXTOPTSTATS".ODCIStatsFunctionCost. Are these used to compute and compare the cost of each index and decide on what index to used? If so, why does it return a lower cost for domain index when the btree index is more efficient? I have all statistics gathered for all tables and indexes (inc dr$ tables and its indexes)
    Thanks,
    jojo

    Hi,
    What I'm pasting here is actually from Ch9 of Expert PL/SQL. It shows what happens during a select with CONTAINS. It does not include a join with another table, or an additional column in the where clause. Hope it helps.
    ================================================
    By default, the Extensible Query Optimizer is enabled. When enabled, the Extensible Query Optimizer can determine the I/O and CPU cost associated with the CONTAINS predicate, find the cost of each call to the CONTAINS() function, and determine the selectivity of the CONTAINS predicate.
    To see this in action I ran the basic select earlier. Examining the SQL trace shows the steps.
    Step 1 - Determine the I/O and CPU cost of the CONTAINS() function:
    --Available online as part of contains_trace.doc
    "CTXSYS"."TEXTOPTSTATS".ODCIStatsFunctionCost(
    sys.ODCIFuncInfo('CTXSYS',
    'CTX_CONTAINS',
    'TEXTCONTAINS',
    2),
    cost,
    sys.ODCIARGDESCLIST(
    sys.ODCIARGDESC(
    2, 'DOCUMENT_REPOSITORY', 'PLSQL',
    '"DOCUMENT"', NULL, NULL, NULL),
    sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL)),
    NULL,
    'constitution',
    sys.ODCIENV(0,0,0,1));
    Step 2 – Determine the selectivity of the CONTAINS predicate
    -- Available online as part of contains_trace.doc
    "CTXSYS"."TEXTOPTSTATS".ODCIStatsSelectivity(
    sys.ODCIPREDINFO('CTXSYS',
    'CTX_CONTAINS',
    'TEXTCONTAINS',
    32),
    sel,
    sys.ODCIARGDESCLIST(
    sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL),
    sys.ODCIARGDESC(5, NULL, NULL, NULL, NULL, NULL, NULL),
    sys.ODCIARGDESC(2, 'DOCUMENT_REPOSITORY', 'PLSQL',
    "DOCUMENT"', NULL, NULL, NULL),
    sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL)),
    0,
    NULL,
    NULL,
    'constitution',
    sys.ODCIENV(0,0,0,1));
    Step 3: Determine the I/O and CPU cost of the CONTAINS predicate
    -- Available online as part of contains_trace.doc
    "CTXSYS"."TEXTOPTSTATS".ODCIStatsIndexCost(
    sys.ODCIINDEXINFO('PLSQL',
    'EXPERT_IDX',
    sys.ODCICOLINFOLIST(
    sys.ODCICOLINFO('PLSQL', 'DOCUMENT_REPOSITORY',
    '"DOCUMENT"', 'BFILE', NULL, NULL)),
    NULL,
    0,
    0),
    50.00000000,
    cost,
    sys.ODCIQUERYINFO(
    2,
    sys.ODCIOBJECTLIST(sys.ODCIOBJECT('SCORE', 'CTXSYS'))),
    sys.ODCIPREDINFO('CTXSYS', 'CONTAINS', NULL, 0),
    sys.ODCIARGDESCLIST(
    sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL),
    sys.ODCIARGDESC(5, NULL, NULL, NULL, NULL, NULL, NULL),
    sys.ODCIARGDESC(2, 'DOCUMENT_REPOSITORY', 'PLSQL',
    '"DOCUMENT"', NULL, NULL, NULL),
    sys.ODCIARGDESC(3, NULL, NULL, NULL, NULL, NULL, NULL)),
    1,
    NULL,
    'constitution',
    sys.ODCIENV(0,0,0,1));
    Note: The 50.00000000 in this last call is the selectivity retrieved from step 2.
    Only after these three steps complete does the query actually get executed:
    -- Available online as part of contains_trace.doc
    SELECT score(1), title
    FROM document_repository
    WHERE CONTAINS(document, 'constitution', 1) > 0
    ORDER BY 1 DESC;
    This is not the end of the processing though. To retrieve the records, the $I table (the index data table) is queried as follows:
    -- Available online as part of contains_trace.doc
    SELECT /*+ INDEX(i) */ TOKEN_FIRST,TOKEN_LAST,TOKEN_COUNT,ROWID
    FROM "PLSQL"."DR$EXPERT_IDX$I" i
    WHERE TOKEN_TEXT = 'CONSTITUTION'
    AND TOKEN_TYPE = 0
    ORDER BY TOKEN_TEXT, TOKEN_TYPE, TOKEN_FIRST;
    Note: The search term is UPPERCASE when querying against the DR$EXPERT_IDX$I table because all of the tokens are stored in uppercase by default. The original SELECT was in lowercase. This automatic conversion to uppercase allows the Text index to provide case-insensitive searching.
    This query returns the following result:
    TOKEN_FIRST TOKEN_LAST TOKEN_COUNT ROWID
    1 2 2 AAAN54AAEAAAOvEAAo
    Finally, the $R table (the rowid table) is queried.
    -- Available online as part of contains_trace.doc
    SELECT data
    FROM "PLSQL"."DR$EXPERT_IDX$R"
    WHERE row_no = 0;
    Only now do I see the results of my query:
    SCORE(1) TITLE
    55 United States Constitution
    8 Bill of Rights
    Keep in mind that modifications to the query, such as the addition of other columns in the where clause or the addition of operators, will result in a different trace.
    ===============================

  • Primary key index not working in a select  statment

    Hi ,
    I'm doing a :
    select *
    from my_table
    where B = v1 and
    A = v2 ;
    where A and B are the primary key of the table, in that table the primary key index is there and the order of the primary key definition is A first and then B.
    While testing this statment in my database the Explain Plan shows that it is using the index ok but when
    runninng in client database it is not using it becasue of the order (i think), is this something configurable that I need to ask to my DBA ?
    The solution I found was to do the select with a hint wich fix the problem , but I'm curious about why is working in my dadabase and not in the client database
    thanks in advance .
    oracle version 11g

    This is the forum for SQL Developer (Not for general SQL/PLSQL questions). Your question would be better asked in the SQL and PL/SQL forum.
    Short answer: The execution plan used will depend on optimizer settings and table/index statistics. For example if the table has very few rows it may not bother using the index.

  • Primary Key could not be changed without dropping the index

    I want to change the primary key in the "alter table modus". I don't see any INDEX. I refresh the DATA and get the following error:
    ORA-01785: ORDER BY-Angabe muss Positionsnummer von Ausdruck der SELECT-Liste enthalten
    Version: 3.0.03 Build-03.97
    Edited by: mesch181 on Apr 17, 2011 12:31 PM

    That error message has nothing to do with dropping an index.
    There is a bug in current versions of sql developer where the query used to populate the data grid is stored and if the table structure changes the query can be invalid. Try closing the table and re-opening it.

Maybe you are looking for

  • IPhone keeps turning on and off from sleep

    When it has been locked/is in sleep mode and screen is black, the phone enters a cycle of about 20 seconds where it will show the unlock screen and after about 6-7 seconds, turn it off again - same as if I were to press the top button and release it

  • Error 7 (Windows 193)

    I have gone through the process described to install the Itunes update.  I have followed the steps provided in the forums and at the end of the installation process a window pops up with a message regarding mobile support update and asking me to veri

  • Using a different icon

    Hi everyone, I have just created 3 captivate movies & a menu for a client & I have just been aske if it would be possible to use there own icon rather than the standard captivate image that is used when the exe file is created. I did not notice any o

  • Accrual fastformula help

    Hi Guru's, Am writing Accrual fast formula for a Indian client. They have 5 different units and each unit has different leave policy. Ex.: 1 unit has 10 days SL(per year .given at the beginning of year) for above manager position and 6 days for below

  • Suspend coverages when adding new dependent

    Hi All , I have a requirement where we have to suspend the coverage when a new dependent is being added (unitll certification is provided) and as an interim coverage the employee should retain the existing coverages . If the new dependent being added