JPA: Error "entity is detached" when executing a query

Hi experts,
I have two database tables with a foreign key constraint and generated JPA-entities for them:
@Entity
public class Verdeck implements Serializable {
     @EmbeddedId
     private VerdeckPK pk;
     @Column(name="ID_VERDECK")
     private String idVerdeck;
     @OneToMany(mappedBy="verdeck")
     @PersistenceContext
     private Set<Uzsb> uzsbCollection;
@Embeddable
public class UzsbPK implements Serializable {
     @Column(name="ID_UZSB")
     private String idUzsb;
     @Column(name="ID_PROJECT")
     private BigDecimal idProject;
Furthermore I have a SessionBean implementing a query in one of its business methods:
@WebMethod(operationName="getVerdeckData", exclude=false)
public List<Verdeck> getVerdeckData (@WebParam(name="searchkey")
     BigDecimal searchkey){
     Query q = em.createQuery("SELECT v FROM Verdeck v WHERE v.pk.idProject = :searchkey")
          .setParameter("searchkey", searchkey);
          return q.getResultList();
When calling the method via WebService-Navigator I get this error:
"com.sap.engine.services.webservices.espbase.server.additions.exceptions.ProcessException: The relationship >>uzsbCollection<< of entity (com.karmann.r57schraub.jpa.Verdeck(idProject=57, idIntern=v1))cannot be loaded because the entity is detached"
(idProject / idIntern) is the composed key of "Verdeck" and (57 / v1) is a concrete value for this key in the database table.
If required I could give you classes VerdeckPK and UzsbPK as well.
Could you please explain what I'm doing wrong?
Thanks for each hint,
Christoph

Hi Vladimir,
thank you for this hint! Especially for the article which provides the neccessary knowledge in background.
But using FetchType.EAGER does not solve my problem. I get a runtime error. In defaultTrace I get the following message
SAXException2: A cycle is detected in the object graph. This will cause infinitely deep XML: com.karmann.r57schraub.jpa.Verdeck@f9ac24 -> com.karmann.r57schraub.jpa.Uzsb@1f2a70 -> com.karmann.r57schraub.jpa.Verdeck@f9ac24]->com.sun.istack.SAXException2: A cycle is detected in the object graph. This will cause infinitely deep XML: com.karmann.r57schraub.jpa.Verdeck@f9ac24 -> com.karmann.r57schraub.jpa.Uzsb@1f2a70 -> com.karmann.r57schraub.jpa.Verdeck@f9ac24#
I already checked the records in my tables. There does not seem to be any cycle. Here's my test data:
VERDECK
ID_PROJECT    ID_INTERN     ID_VERDECK
57                    v1                  vext1
57                    v2                  vext2
UZSB
ID_PROJECT ID_UZSB ID_INTERN TYP_UZSB
57 ls1 v1 <null>
57 rs1 v1 <null>
57 sd1 v1 <null>
57 ls2 v2 <null>
57 rs2 v2 <null>
57 sd2 v2 <null>
Do you have any more idea?
Regards,
Christoph

Similar Messages

  • How to get error's field name when execute sql error

    I want to get the error's field name when execute sql error,but SQLException is not provide corresponding function to get it.
    How can I do for it?

    user523110,
    I believe the "unique constraint" error message displays the name of the constraint, not the column name, as you have posted.
    As far as I know, the only way to extract the column(s) would be to query the data dictionary using the constraint name provided in the error message.
    Also, as far as I know, there is nothing in the JDBC API that can return the names of the columns associated with a given unique constraint.
    Good Luck,
    Avi.

  • How can i know which index will be used when executing the query ?

    1 ) I have query in which i have 3-4 tables but there multiple index on one column .
    so how can i know which index will be used when executing the query ?
    2) I have a query which ia taking too much time . how can i know which table is taking too much time ?
    3) Please Provide me some document of EXplain plan ?

    Hi Jimmy,
    Consider the below example
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    CREATE TABLE FIRST AS
    SELECT * FROM all_objects;
    UPDATE FIRST
    SET object_name = 'TEST'
    WHERE owner != 'SCOTT';
    CREATE INDEX idx_first ON FIRST(object_name);
    SELECT *
    FROM FIRST
    WHERE object_name = 'TEST';
    It has not used index
    Execution Plan
    Plan hash value: 2265626682
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 58678 | 7334K| 163 (4)| 00:00:02 |
    |* 1 | TABLE ACCESS FULL| FIRST | 58678 | 7334K| 163 (4)| 00:00:02 |
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    SELECT *
    FROM FIRST
    WHERE object_name = 'emp';
    This has used the index
    Execution Plan
    Plan hash value: 1184810458
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 128 | 1 (0)| 00:00:01 |
    | 1 | TABLE ACCESS BY INDEX ROWID| FIRST | 1 | 128 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | IDX_FIRST | 1 | | 1 (0)| 00:00:01 |
    From this we can come to the conclusion that, whether to use one index or not by oracle
    would also depend on the data which is present in the table. This has to be this way as
    we see in the bind peeking, if oracle sticks to only one plan, say only use the full table
    scan, it would be a performance hit when it searches for the second query ie where object_name
    ='emp';
    2.
    If we have a query like below.
    select * from emp
    where upper(ename) = upper(:p_ename);
    Evenif we have the index on ename column, oracle wouldn't be able to use the index, as there is a function in the predicate column. If you need oracle to use the index, we need to create a function based index as below.
    Create index idx_ename on emp(upper(ename));
    Regards,
    Cool

  • Incorrec entries when execute the query

    hi,
       I am facing one problem when execute the query on inventory cube(non cumulative cube).Query is diplaying entries for valuated stock Qty.on particular date, but those entries are not exist in BIW(Infocube ,ODS) or R/3 System.
    I checked cache parameters. all settings are correct.
    if anyone has the idea on this  pls. do the needful
    Thanks n Regards,
    HReddy.M
    I

    hello,
          Try to drill down the report based on request ID and find out one record which has this inconsistancy...! then see the data in the CUBE based on that Req ID and PSA..! may be this way will help u out..!
           Check FS10N/MB5B/MB5L Tcodes in R/3 for reconcilation!
                 -EnjoySAP

  • Short dump when executing the query

    Hello Friends,
                         I have a query from MM area which I have insalled from Business Content , and when I try to go to the edit mode or try to excute the query I get a short dump which says "Missing elements ..", I get the same dump when executing from query designer or RSRT . At this time I'm not able to do a "check" on the query also n query designer since it doesnot allow me to go to the edit mode also . Any inputs greatly appreciated .
    thanks ,

    Hi,
    While activating it from the Business Content, have you activated all the underlying objects also. Pls check that. It might help.

  • Error when executing a Query through information Broadcasting

    Dear SDN,
    We have configured information Broadcasting in the Web Reports---
    Scheduled and then when executing the following error is coming
    500 internal server error - Microsoft internet explorer
    Error when processing your request
    What has happened?
    The URL http://xyz.com:8000/sap/bw/BEx was not called due to an error.
    Note
    The following error text was processed in the system BWD : Please enter a valid value for characteristic 0CALMONTH.
    The error occurred on the application server asalbwd_BWD_00 and in the work process 0 .
    The termination type was: ERROR_MESSAGE_STATE
    The ABAP call stack was:
    START-OF-SELECTION of program RSRD_BROADCAST_PROCESSOR
    What can I do?
    If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system BWD in transaction ST22.
    If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server asalbwd_BWD_00 in transaction SM21.
    If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server asalbwd_BWD_00 . In some situations, you may also need to analyze the trace files of other work processes.
    If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http-c:900-u:VENKAT -l:E-s:BWD-i:asalbwd_BWD_00 -w:0-d:20080708-t:133744-v: ERROR_MESSAGE_STATE-e:Please enter a valid value for characteristic 0CALMONTH.
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team
    Please suggest us to resolve this error..
    Help will be greatly appreciated with points..
    Thanks in advance

    Hi
    Thanks...
    I have given only Fiscal Year/Period Variable
    Other than Fiscal Year/Period Variable....No Variables in that Query..
    In FI Queries, I did not use 0CALMONTH Variable...
    I do not know why it is giving that error..
    Please suggest us to resolve this error..
    Thanks in advance

  • Error when executing a query on upgraded system

    Hi All,
    We are in the process of upgrading our BI system. Currently we are on Quality system and its a copy of existing production system. I have executed a query on the production system (3.5 system) successfully.
    But the same query when I'm trying to execute on the upgraded quality system (BI 7.0), I get an error " warning info provider was changed or activated at runtime. The query cannot be opened". The same message doesn't pop up on the current 3.5 BI system.
    Can anyone help me how I can correct this error?
    regards,
    Suman

    Hi All,
    I activated the Infoset and I could eliminate the error. Now the issue is solved.
    Thanks

  • Error when executing a query on master data

    Hi Friends,
    When I execute a query fon Master Data Characteristic infoObject ( 0BPARTNER ) from BEx Analyzer I got the below error. 0BPARTNER contains 15 attributes. I am getting the below error only for this query. Rest all other queries are working good with the same BEx Analyzer.
    <b>An error occured in the communication with the BW Server.
    Due to this connection has to be closed.</b>
    <b>Detailed Description:
    The system is configured incorrectly.</b>
    Please tell me what could be the problem? How to overcome this?
    Thanks,
    Sasi

    Hi Arun,
    Before the execution of query I did that. And it was ' Query is Correct'.
    Any more ideas?
    Thanks,
    Sasi.

  • When executing a query showing as ABAP runtime error RAISE_EXCEPTION

    Hi all,
    When i executed a query, it is showing as ABAP runtime error RAISE_EXCEPTION in the short dump.
    This is the Analysis in Short dump (ST22)...............
    Exception condition "DATE_BEFORE_RANGE" raised.   
    What happened?                                                                               
    The current ABAP/4 program encountered an unexpected  
    situation. 
    Error analysis                                                                               
    A RAISE statement in the program "SAPLSCAL" raised the exception
    condition "DATE_BEFORE_RANGE".                                  
    Since the exception was not intercepted by a superior program   
    in the hierarchy, processing was terminated.                                                                               
    Short description of exception condition:                                                                               
    Date is earlier than factory calendar definition                                                                               
    For detailed documentation of the exception condition, use      
    Transaction SE37 (Function Library). You can take the called    
    function module from the display of active calls.               
    How to correct the error                                                                               
    You may able to find an interim solution to the problem                       
    in the SAP note system. If you have access to the note system yourself,       
    use the following search criteria:                                                                               
    "RAISE_EXCEPTION" C                                                           
    "SAPLSCAL" or "LSCALU06"                                                      
    "DATE_CONVERT_TO_FACTORYDATE"                                                                               
    or                                                                               
    "SAPLSCAL" "DATE_BEFORE_RANGE"                                                                               
    or                                                                               
    "WRITEQUERY " "DATE_BEFORE_RANGE"                                                                               
    Could you pls any one tell me what could be the problem and how to reslove this issue.
    Thanks & Regards,
    Ravi Kumar.

    Hi Andre,
    Maintain your factory calendar idents Valid To year field (BJAHR) in Table TFACD
    You can do this via tcode SCAL, or navigate through SPRO.
    Most likely you have your factory calendars set with Valid To dates as 2010. You may also be encountering some load issues depending on exit routines used in transformations in determining workdays/factory days etc.
    Thanks,
    Eric Filmer

  • No space left in shared memory error when executing a query

    Hi,
    When I executed a query, it showed the results. But when I drilled down it by material, it showed the following error message.
    Error An exception with the type CX_SY_EXPORT_NO_SHARED_MEMORY occured
    Error No space left in shared memory
    Is there anyone know what is the reason and how to resolve?
    Many Thanks
    Jean

    Your report got too big and you ran out of memory on the server.
    Run it for a smaller data set (e.g., a few months instead of a year) to avoid this problem.
    Hope this helps...
    Bob

  • Error with Project Parameters when executing the package with dtexec command

    Hi,
    We have started migrating our SSIS package from 2005 version to SSIS 2012. In SSIS 2005 we were using XML configuration files and executing the packages with dtexec command from the packages folder (without deploying packages to filesystem).
    Now in SSIS 2012, we have seen Project Parameters and created couple of package parameters and used those parameters in the package. when executing this package from solution explorer it was working fine but when i try to execute the same package from command
    line with Dtexec command, it was showing an error message of 'Not able to map Project Prameters to configurations'.
    Could you please give me an idea of how to execute the packages from command line by using dtexex command. basically i would like use project parameters in 2012 similar to configurations?
    Thanks,
    Venu.

    Refer
    http://msdn.microsoft.com/en-IN/library/hh231187.aspx
    you can pass parameter like this
    /SET \Package.Variables[$Package::ParameterName];<value> /SET \Package.Variables[$Project::ParameterName];<value>
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Error when executing the query or refreshing the workbook

    Hi All,
    Whenever I am trying to execute a query or refresh a workbook a error message is poping up saying that
    Error: <internal error> Problem when writing table: E_T_cel.
    I face this error in few of the queries and when i refresh workbooks. These queries have lot of calculations and filters and they sum up lot of records.
    Any help greatly appreciated.
    Thanks
    Raj.

    Hi Maik,
    Thanks for reply, I went into tran sm21 but i could not understand the messages there. Below is the list of messages in sm21
                         System Log: Local Analysis of cdsap9d                    1                                                    
    From date/time............. 04/20/2005 / 10:00:00
    To date/time............... 04/21/2005 /        
    User....................... KADALPR    
    Transaction code...........                    
    Terminal...................        
    Task.......................  
    Problem class..............           
    Further restrictions.......                                                                               
    Sorted ? ................ SOFI
    Pages with single entries 00000100
    With statistics............ 
                         System Log: Local Analysis of cdsap9d                    2                                                    
    Time     Ty. Nr Cl. Tcod MNo Text                                                                                Date : 20.04.05 
    12:58:10 DIA  0 100      R49 Communication error, CPIC return code 019, SAP return code 728                                                 
    12:58:10 DIA  0 100      R5A > Conversation ID: 29858195                                                                               
    12:58:10 DIA  0 100      R64 > CPI-C function: CMSEND(SAP)                                                                               
    12:58:10 DIA  0 100      R68 Perform rollback                                                                               
    12:58:10 DIA  0 100      R47 Delete session 001 after error 003                                                                             
    23:54:49 DIA  1 100      R49 Communication error, CPIC return code 019, SAP return code 728                                                 
    23:54:49 DIA  1 100      R5A > Conversation ID: 44959947                                                                               
    23:54:49 DIA  1 100      R64 > CPI-C function: CMSEND(SAP)                                                                               
    System Log: Local Analysis of cdsap9d                    3                                                    
    Time     Ty. Nr Cl. Tcod MNo Text                                                                                Date : 21.04.05 
    09:32:50 DIA  2 100      R49 Communication error, CPIC return code 019, SAP return code 728                                                 
    09:32:50 DIA  2 100      R5A > Conversation ID: 83536783                                                                               
    09:32:50 DIA  2 100      R64 > CPI-C function: CMSEND(SAP)                                                                               
    Reading:  
    Number of records read.........       2777
    Number of records selected.....         11
    Old records skipped............       2733
    Records of invalid users skippe         33
    Further selection:  
    Number of records read.........         11
    Number of records selected.....         11
    Number of records printed......         11
    End of system log
                         System Log: Local Analysis of cdsap9d                    4                                                    
                        C o n t e n t s                              
    Contents              Page              Start            End  
    Selection criteria     1
                           2        20.04.2005  12:58:10 - 23:54:49
                           3        21.04.2005  09:32:50 - 09:32:50
    Contents               4
    End of program  -
    If you can help me out as where to look at these messages then it great.
    Thanks,
    Raj.

  • ORA-29902 Error when executing context query

    We sometimes get the following error when executing a search based on keywords entered by a user:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Error generating context stmt ORA-29902: error in executing ODCIIndexStart() routine ORA-20000: interMedia Text error: DRG-50901: text query <HR></BLOCKQUOTE>
    A demonstration of the error can be seen by going to the main
    http://technet.oracle.com technet page and then performing a site search. Type in any of the following search phrases:
    Oracle and not Microsoft
    not Microsoft
    and database
    In my brief experimentation, the presence of any of
    not, and, or
    at the beginning of the keywords, or next to each other 'and not' within the keywords set causes the above oracle error.
    OK, I could train the users not to do this, but with the potential for every net user on the planet using my site, it might take me some time to speak to all of them.
    So how do I stop Intermedia from throwing up the error? I have written a quick parser to try to strip out offending entries, but that is not, imho, a good solution, as I do not know all the rules that will break it.
    tia

    You need to write a text query parser. Check the Query Translator code samples from http://technet.oracle.com/sample_code/products/text/content.html

  • DUMP in SAPDBEQI when executing a Query with InfoSet = EQI

    Hi experts,
    I made a Query that contains an Infoset, with the logical database EQI. When I execute the query it shows the following DUMP:
    Runtime Errors = SAPSQL_AMBIGUOUS_FIELDNAME 
    Except.            = CX_SY_DYNAMIC_OSQL_SEMANTICS
    Maybe is an error? I think it is, but searching for a SAP Note I don't find anyone.
    What I could see is that the system is executing an extra validation, with this authority check:
    * additional authority checks via BAdI
      PERFORM authoritycheck_diaufk_badi_f01 USING diaufk 'IE07'.
    This function is encapsulated on the include "DBAFIF01".
    I am executing the SAP Query on version ECC 6.0.
    Lots of thanks,
    Javi

    Hi FireFighter,
    First of all, thanks for your answer. I have no problem of authorization to execute IE07.
    Do you have any other idea?
    Thanks!!!

  • BEX :Selection screen missing when executing a query

    Hi all,
                When I am executing a query through BEX Analyzer,I am not getting the Selection Screen Popup.Instead ,the report is directly being generated.So,this is giving rise to various problems.But when the user is executing through portal,he is getting  the selection screen.
    I am not getting this Selection screen popup in all the DEv,Quality,PreProd and Production systems.And hence ,i am  not able to give the selections for a report
    Can anyone please provide a solution for this?
    Awaiting your response.
    Thanks,
    Amar

    Hi,
    Our GUI version is 710 and 640 is recommended by the client.Hence, no problem with that.The user is able to execute more than one query.
    Do u think it is a basis or security related issue.Or is it  due to Application of some GUI Patches.
    Thanks,
    Amar

Maybe you are looking for