Group by, with and without where clause

Do I need to use these two interior views to display the results by group by a line? I can get the same result without having to type the same statement select twice since these two SELECT statements differ only in where clause. This query is a simulation. My actual query is longer. My hope is to make this shorter query (without interior views).
with tmp as (
select 'COMPLETE' status, 'GERMANY' country, 0 substatus FROM dual UNION ALL
select 'COMPLETE' status, 'GERMANY' country, 1 substatus FROM dual UNION ALL
select 'COMPLETE' status, 'GERMANY' country, 0 substatus FROM dual)
select v1.status, v1.country, v1.cnt01, v2.cntIncluding0 from 
(select status, country, count(*) cnt01 from tmp tmp1 group by status, country) v1
JOIN
(select status, country, count(*) cntIncluding0 from tmp tmp2 where substatus=0 group by status, country) v2
on v1.status=v2.status and v1.country=v2.country;
 

totalnewby wrote:
Do I need to use these two interior views to display the results by group by a line? I can get the same result without having to type the same statement select twice since these two SELECT statements differ only in where clause. This query is a simulation. My actual query is longer. My hope is to make this shorter query (without interior views).

with tmp as (
select 'COMPLETE' status, 'GERMANY' country, 0 substatus FROM dual UNION ALL
select 'COMPLETE' status, 'GERMANY' country, 1 substatus FROM dual UNION ALL
select 'COMPLETE' status, 'GERMANY' country, 0 substatus FROM dual)
select v1.status, v1.country, v1.cnt01, v2.cntIncluding0 from
(select status, country, count(*) cnt01 from tmp tmp1 group by status, country) v1
JOIN
(select status, country, count(*) cntIncluding0 from tmp tmp2 where substatus=0 group by status, country) v2
on v1.status=v2.status and v1.country=v2.country;
SQL> with tmp as
  2  (
  3  select 'COMPLETE' status, 'GERMANY' country, 0 substatus FROM dual UNION ALL
  4  select 'COMPLETE' status, 'GERMANY' country, 1 substatus FROM dual UNION ALL
  5  select 'COMPLETE' status, 'GERMANY' country, 0 substatus FROM dual
  6  )
  7  select status,
  8         country,
  9         count(substatus) cnt01,
 10         sum(decode(substatus, 0, 1, 0)) cntincluding0
 11    from tmp
 12   group by status, country
 13  ;

STATUS   COUNTRY      CNT01 CNTINCLUDING0
-------- ------- ---------- -------------
COMPLETE GERMANY          3             2

Tags: Database

Similar Questions

  • Materialized view does not quickly refresh with sysdate in where clause

    Hi all

    I am trying to create a view, materialized with sysdate in where clause. This makes the complex query, and so I can't create a quick refreshment mview.

    I tried to create with rowid too, but it does not create a quick refreshment.

    I was wondering if someone can advise me, how can I accomplish this task, which would be really appreciated.

    The query is:

    create a materialized view PS_MEETING

    build the DEFERRED payment

    Refresh quickly with rowid

    as

    SELECT *.

    MEETING M

    WHERE state_desc = 'VIC '.

    OR Meet_date < TRUNC (SYSDATE);

    the behavior is documented: http://docs.oracle.com/cd/E11882_01/server.112/e25554/basicmv.htm#DWHSG8201

    General restrictions on update quickly

    The definition of the materialized view query is limited as follows:

    • The materialized view must not contain references to non-repetitive phrases such as SYSDATE and ROWNUM .

    So I guess that you would need a more static than sysdate condition - or another strategy update.

  • Programs to freeze or close with and without notice.

    programs to freeze or close with and without notice, that it is not a difference if I'm on the internet or not.  I am constantly notices that a certain program has stopped working and will try to restart.  Sometimes it will be and sometimes not.  Sometimes I also get opinion that something or another can be read at 0xxxxfffff or something like that.  I had these problems all the time I've had this computer.  I tried everything I can think of to fix it without success.  I had my provider ISP here at least three times, I returned the computer to the gateway and had replaced ethernet card, I ran several other registry fixing programs, I've updated all the drivers, I rebooted windows program and started from zero to three times, I took the CPU back instead of purchase (new) they said they could find no problem.  Please help me, I want so badly to take this computer at the door, but I can't afford something different.

    Hi Cherarose,

    I suggest that you contact the manufacturer of the computer and to update the drivers from the chipset and updateBasic system of input/output (BIOS) to the latest version, check if this help.

    BIOS: Frequently asked questions

    http://Windows.Microsoft.com/en-us/Windows-Vista/BIOS-frequently-asked-questions

    Important: Change (CMOS) BIOS/complementary metal oxide semiconductor settings can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the configuration of the BIOS/CMOS settings can be solved. Changes to settings are at your own risk.

    Optimize the performance of Microsoft Windows Vista

    http://support.Microsoft.com/kb/959062

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • I just bought the edition student pro Adobe Acrobat XI from amazon. The installation wizard does not recognize my valid serial number. I entered it with and without a hyphen. What should I do?

    I just bought the edition student pro Adobe Acrobat XI from amazon. The installation wizard does not recognize my valid serial number. I entered it with and without a hyphen. What should I do?

    Is the serial number a 24 digit code?

    It is best to contact the Support from Adobe and check with the serial number once:

    "Click the button still needing help, and then select the Chat option:

    https://helpx.Adobe.com/contact.html?step=CCSN_membership-account-payment_account-settings _stillNeedHelp

  • After you download CC Office at the beginning of the installation, I get the error 049. It was the 9th try to install for 1 week - with and without administrative rights.

    After you download CC Office at the beginning of the installation, I get the error 049. It was the 9th try to install for 1 week - with and without administrative rights.

    Hello

    Please see error download or update Adobe Creative Cloud applications

    Hope that helps!

    Kind regards

    Sheena

  • Difference-conditions (join and a Where Clause)

    Hi people,

    I need to clearly agree on what a difference exactly when we put any condition in INNER JOIN and the WHERE Clause.

    I have tried both way and found the same results. Even in the statistics Plan not much differences.  Any help would be appreciated.

    As:

    1 here, I use filter store in the join condition - Inner

    "SELECT i., Gl * Sc1.Item I.

    Inner Join Sc1.Part P

    On P.Part_Id = I.Part_Id

    Inner Join Sc1.Location Gl

    On Gl.Location_Id = I.Location_Id

    And Gl.Location_Id in (1767, 1747,202,1625)

    Inner Join Sc1.Condition C

    On C.Condtion_Id = Gl.Condition_Id

    Where I.Inactive_Ind = 0

    And I.Condition_Id! = 325

    2. here I use filter store in Where clause-

    SELECT i., Gl * Sc1.Item I

    Inner Join Sc1.Part P

    On P.Part_Id = I.Part_Id

    Inner Join Sc1.Location Gl

    On Gl.Location_Id = I.Location_Id

    Inner Join Sc1.Condition C

    On C.Condtion_Id = Gl.Condition_Id

    Where I.Inactive_Ind = 0

    and I.LOCATION_ID in (1767, 1747,202,1625)

    And I.Condition_Id! = 325

    Thank you

    Mark



    Hello

    MarkCooper wrote:

    Hi guys,.

    To reply to all - I understand.

    1. its good practice to use conditions / filter (except CLAUSE) in the WHERE Clause rather Inner join? bon ?

    2. now, in my previous example. We could use the location code in where clause as it was in the two tables.

    What is the best practice to use the code to location here ( 1 /2) ?

    1. here I use filter store in the Inner join condition ( guess the location code is not in the article table)).

    "SELECT i., Gl * Sc1.Item I.

    Inner Join Sc1.Part P

    On P.Part_Id = I.Part_Id

    Inner Join Sc1.Location Gl

    On Gl.Location_Id = I.Location_Id

      And Gl.Location_Id in (1767, 1747,202,1625)

    Inner Join Sc1.Condition C

    On C.Condtion_Id = Gl.Condition_Id

    Where I.Inactive_Ind = 0

    And I.Condition_Id! = 325

    2. here I use filter store in Where clause (assume that the location code is not in the article table)-

    SELECT i., Gl * Sc1.Item I

    Inner Join Sc1.Part P

    On P.Part_Id = I.Part_Id

    Inner Join Sc1.Location Gl

    On Gl.Location_Id = I.Location_Id

    Inner Join Sc1.Condition C

    On C.Condtion_Id = Gl.Condition_Id

    Where I.Inactive_Ind = 0

      And Gl.Location_Id in (1767, 1747,202,1625)

    And I.Condition_Id! = 325

    Thank you

    If location_id isn't in the item table, then the join condition

    On Gl.Location_Id = I.Location_Id

    will cause an error.

    Once more, it should not affect results or performance if a condition like

    Gl.Location_Id in (1767, 1747,202,1625)

    is in the clause or the WHERE clause.  No matter if it is be a column called location_id in any other table, or if the same column Gl.Location_Id is used in other conditions.

    As this condition only refers to a table (GI), I recommend you put it in a WHERE clause, just to make the code clearer.

    Yet once, this applies only to the inner joins, not for outer joins and not to CONNECT BY queries.

  • Small design on the points of view and a Where Clause Board...

    Hi all...  I just want to check Im doing things right, and he is not a better way to do this...

    Running APEX 4.2.5 and XE 11.2

    Ive built my application around a community of users who have access to certain groups of data...  Ive designed so that there are views and then transparent filter the data of a given user. for example, the view below seamlessly that users can see the filters depending on which application they use, they can see more specifically, what are the features and finally, what group they are actually in.

    Create view ENTITIES like)

    Select * from t_entities t

    where exists (select 1

    of application_groups ag

    where ag.object_name = 'ENTITIES '.

    and ag.object_id = t.entity_id

    and ag.group_name = 'CASH FLOW')

    and exists (select 1 from entity_users EU

    where eu.username = nvl (v ('APP_USER'), USER) / * APEX APPLICATION USER * /.

    and eu.entity_id = t.entity_id)

    and it exists (select 1 from entity_group_members for example

    where eg.entity_group = v('G_ENTITY_GRP_ID') / * ENTITY_GROUP * /.

    and eg.entity_id = t.entity_id)

    )

    The overall costs when I run the explain command is very low (23 or almost), so I think that its an effective way of filtering... However, out of 300 entities or greater, the vast majority of users (75%) can see 75% of data...  Also, I need to create another view to filter another set of data with 2000 records. one with the view in place, 95% of the staff will see 95% of the data and only 10% of the staff see the other 10%...

    I note that its faster when a member of a group brings back only a tiny part of the data compared to the other way around... This is why Im asking before implementing another view of the same type.

    So, on my question. Is there a better way to do this, or the query should be on there head with a WHERE clause does NOT EXIST (xxxxx! = yyyyy)) or soemthing else ther is quite that Ive missed...

    The only other comment is that Im using the upper table "APPLICATION_GROUPS" for more than one type of object (i.e. entities and entity accounts banking..) y at - it no merit in separaitng the two into two tables?

    Thank you very much

    Richard

    Hi Richard,

    Miss me a lot of information but:

    I think that your design could be allowed. It seems a little too mat, maybe, but I think this could work.

    It is important to have the good indexing and use compression of index:

    On application_groups (object_name, the GroupName, groupname) compresses

    IT compresses to entity_users (username, entity_id)

    On the entity_group_members (entity_group, entity_id) compress

    I think v as v ('G_ENTITY_GRP_ID') is a user-defined function? If so, if possible, set the deterministic and uses result_cache.

    Consider partitioning application_groups type (= object_name?)

  • List with variable selection where clause to sys_refcursor

    Hello

    I have a procedure that have input parameters to put in a where clause and return clause a sys_refcursor. Below you can see a simplified procedure, do not use bind variables, r I think it's the best solution. For now, the real parameterlist varies from 5 to 8.

    "Dbms_sql" is not possible because I need a sys_refcursor as output. (To a .net application running on 10 g 2).
    'Use' is not possible due to the variable number of parameters.

    I can also use "col1 = NVL(:bind,col1)" for each parameter, but this will slow down the query I think.

    Are there other ways to solve this problem, or should I go with the unbound version or binded?

    Thank you, Jan
    PROCEDURE p_select(p1 IN  VARCHAR2
                      ,p2 IN  NUMBER
                      ,pc OUT SYS_REFCURSOR)
    IS
      l_stmt  VARCHAR2(100);
      l_where VARCHAR2(100);
    BEGIN
      IF p1 IS NOT NULL THEN
        v_where := v_where ||' AND col1 = '''||p1||'''';
      END IF;
      
      IF p2 IS NOT NULL THEN
        v_where := v_where ||' AND col2 = '||p2;
      END IF;
      
      l_stmt := 'SELECT id FROM t WHERE active = 1'||lv_where;
      
      OPEN pc FOR l_stmt;
    END;

    A reasonable and efficient approach for this kind of problem is probably described here.

  • Optimize query with function in where clause

    Hello

    I have a query like this:

    SELECT * FROM table_1 t
    WHERE
    (
    -- Clause A (very long clause that filters a lot of rows)
    )
    AND f(t.field) = 'Y' -- This function is heavy but it should filter few rows
    

    This query, it is very slow because I think he's trying to evaluate f() for all rows in table_1.

    Howerver, if I have database query:

    SELECT f(t.field) FROM table_1 t
    WHERE
    (
    -- very long clause that filters a lot of rows
    )
    

    It's very fast.

    How can I reference the query to filter the lines of division A, then by function?

    Thanks in advance!

    If you wrap the function in a select clause then the optimizer can use a scalar subquery caching:

    SELECT * FROM table_1 t 

    WHERE  (  -- Clause A (very long clause that filters a lot of rows)  ) 

    AND (Select f(t.field) From Dual) = 'Y' -- This function is heavy but it should filter few rows

  • Calling functions with and without parentheses

    Hello

    I was wondering why it is that I can create a function and call it with or without brackets (for example "select double f" OR 'Select double f()'), but I can call only SYSDATE, CURRENT_DATE etc. without parentheses.  If I do this "select SYSDATE() from dual", I get an error.

    SYSDATE is a function, no?

    Does anyone know?  I'm just curious.

    Thank you

    Jason

    It's funny how incompatible Oracle is. SQL SYS_GUID function must be specified with the bracket, while his counterpart from PL/SQL it takes two ways:

    SQL > set serveroutput on
    SQL > exec dbms_output.put_line (sys_guid);
    EDC6F517330B4F1281739CB7184CD3F0

    PL/SQL procedure successfully completed.

    SQL > exec dbms_output.put_line (sys_guid ());
    2FDB6ECD6F4042CA91068E0CC9EF4599

    PL/SQL procedure successfully completed.

    SQL >

    Reason is - after all the "single engine" about Oracle SQL and PL/SQL are always two separate motors. PL/SQL counterpart functions are declared in SYS. The STANDARD package, so if we want to use the parentheses, we could refer to SYS. SQL STANDARD:

    SQL > select sys.standard.sys_guid from double;

    SYS_GUID
    ---------------------------------------------
    3452B1206ABE484187A09928C1960F93

    SQL > select sys.standard.current_date (double);

    SYS. STAND
    ---------
    JUNE 10, 13

    SQL >

    However, works such as SYSDATE, USER and a few others are not is the standard package and we have not choice but do not use parentheses.

    SY.

  • Saving files with and without watermark from photoshop in lightroom

    Hi all

    I have problems with the registration of 2 of the same photo to Photoshop in Lightroom.

    So I opened my image in Lightroom and I change it, I then open in Photoshop and edit the rest of the way.  I then click on save (which places it in Lightroom).  I then went back to Photoshop and add my watermark, which

    I'm having a problem with and then saves this copy.  When I try to save the watermark image will replace the photo that I just saved which is a not the mark of the water, so instead of having all 3 (original, edit and edit watermark) I will have only 2.  How I can save the final edit, then save it again with the watermark that both end in lightroom?

    Hope that makes sense, I just downloaded them so that they are of the most recent edition.

    Thank you

    Hi JaydeWinkworth,

    Once you have finished editing your images in Lightroom, you can right click on the Image to change in Photoshop.

    Once you have plenty of Image in Photoshop, you can apply all the editing (including the watermark) and save it, once you save the images that he goes back to Lightroom as PSD or tiff (separate Image)

    Reference: Adobe Photoshop Lightroom Help | Editing photos Lightroom in Photoshop or Photoshop Elements

    It will be useful.

    Kind regards

    ~ Mohit

  • left outer join and the where clause for the table to the right

    I want to join two tables a and b, where a is a must and b is a result set in option. When I use a left outer join to a to b, I want to achieve:

    1. Select a single column, two columns of b (not the join columns)
    2 - even if theres no friendly on the join column does not return data from one.
    3. If there is a match applies when the criteria on column b (table in option)

    so, how can I avoid no_data_found in this case? When I apply where criteria for b, so it does not return the data from one, which is a must.

    Sounds like a regular outer join to me...

    select a.col1, b.col2, b.col2
    from   tableA a
           left outer join tableB b
           on (a.id = b.id and b.colX = 'X')
    
  • count all values with a special WHERE clause in a select group?

    Hello

    I have the following table 1:

    code, month, value
    * 1,1,40 *.
    * 1,2,50 *.
    * 1,3,0 *.
    * 1,4,0 *.
    * 1,5,20 *.
    * 1,6,30 *.
    * 1,7,30 *.
    * 1,8,30 *.
    * 1,9,20 *.
    * 1,10,20 *.
    * 1,11,0 *.
    * 1,12,0 *.

    * 2,1,10 *.
    * 2,2,10 *.
    * 2,3,20 *.
    * 2,4,20 *.
    * 2,5,20 *.
    * 2,6,30 *.
    * 2,7,40 *.
    * 2,8,50 *.
    * 2,9,20 *.
    * 2,10,20 *.
    * 2,11,20 *.
    * 2,12,20 *.


    This is a table with 3 columns, first column is a code, second is the number of months, third, one is a value.
    Now, I want to select records for each code. For example, all records for the code = 1.
    I want to count how many values = 0 for this code = 1. After this count, I want to update the value with the number 0.

    For my example:
    Code 1, there are 4 fields with the value 0. So, I want to update all values from code 1 to 4.
    The second code = 2 there is no value = 0. So, I want to update the values of code2 to 0.

    This should be the result:
    code, month, value
    * 1,1,4 *.
    * 1,2,4 *.
    * 1,3,4 *.
    * 1,4,4 *.
    * 1,5,4 *.
    * 1,6,4 *.
    * 1,7,4 *.
    * 1,8,4 *.
    * 1,9,4 *.
    * 1,10,4 *.
    * 1,11,4 *.
    * 1,12,4 *.

    * 2,1,0 *.
    * 2,2,0 *.
    * 2,3,0 *.
    * 2,4,0 *.
    * 2,5,0 *.
    * 2,6,0 *.
    * 2,7,0 *.
    * 2,8,0 *.
    * 2,9,0 *.
    * 2,10,0 *.
    * 2,11,0 *.
    * 2,12,0 *.


    My question is:
    Is it possible in oracle to count in a select (or in an insert/update statement) all values = 0 for a group (in this example, named code) and make an update in the same statement for this group?

    I hope someone can give me a hint, if possible?

    Thank you very much.
    Best regards


    Tim

    something like that? NOT TESTED *.

    Setting a DAY Table1 a SET A.Value = (SELECT COUNT (B.ROWID) FROM Table1 B WHERE A.Code = B.Code AND B.Value = 0);

  • Syntax of UPDATE of Oracle with the JOIN and the WHERE clause

    I need to update one of my paintings and can't seem to get the syntax right. I tried 4 different approaches, but does not have a chance.  Any help would be greatly appreciated.

    Attempt #1: Error: not correctly completed SQL command

    UPDATE TESTDTA.F4941
    SET TESTDTA.F4941.RSDSTN=TESTDTA.F4981.FHRTDQ,TESTDTA.F4941.RSUMD1=TESTDTA.F4981.FHUOM
    FROM TESTDTA.F4941
    INNER JOIN TESTDTA.F4981
    ON TESTDTA.F4941.RSSHPN  = TESTDTA.F4981.FHSHPN
    WHERE TESTDTA.F4941.RSSHPN = 647143
    AND TESTDTA.F4941.RSDSTN = 0
    AND TESTDTA.F4941.RSADDJ  > 110365
    AND TESTDTA.F4981.FHCGC1  = 'DIS';

    Try #2: Error report: SQL error: ORA-00904: "TESTDTA." "" F4981 ". "' FHUOM ': invalid identifier 00904. 00000 - '% s: invalid identifier '.

    UPDATE (SELECT TESTDTA.F4941
    FROM TESTDTA.F4941
    INNER JOIN TESTDTA.F4981
    ON TESTDTA.F4941.RSSHPN  = TESTDTA.F4981.FHSHPN
    WHERE TESTDTA.F4941.RSSHPN = 647143
    AND TESTDTA.F4941.RSDSTN = 0
    AND TESTDTA.F4941.RSADDJ  > 110365
    AND TESTDTA.F4981.FHCGC1  = 'DIS')
    SET TESTDTA.F4941.RSDSTN=TESTDTA.F4981.FHRTDQ,TESTDTA.F4941.RSUMD1=TESTDTA.F4981.FHUOM


    Try #3: Error report: SQL error: ORA-00904: "TESTDTA." "' F4941 ': invalid identifier 00904. 00000 - '% s: invalid identifier '.

    UPDATE (SELECT *
    FROM TESTDTA.F4941
    INNER JOIN TESTDTA.F4981
    ON TESTDTA.F4941.RSSHPN  = TESTDTA.F4981.FHSHPN
    WHERE TESTDTA.F4941.RSSHPN = 647143
    AND TESTDTA.F4941.RSDSTN = 0
    AND TESTDTA.F4941.RSADDJ  > 110365
    AND TESTDTA.F4981.FHCGC1  = 'DIS')
    SET TESTDTA.F4941.RSDSTN=TESTDTA.F4981.FHRTDQ,TESTDTA.F4941.RSUMD1=TESTDTA.F4981.FHUOM;


    Try #4: Error: ORA-00925: Missing keyword 00925. 00000 - "missing IN the keyword"

    MERGE TESTDTA.F4941
    USING TESTDTA.F4981
    ON (TESTDTA.F4941.RSSHPN  = TESTDTA.F4981.FHSHPN
    AND TESTDTA.F4941.RSSHPN = 647143
    AND TESTDTA.F4941.RSDSTN = 0
    AND TESTDTA.F4941.RSADDJ  > 110365
    AND TESTDTA.F4981.FHCGC1  = 'DIS'
     
    )
    WHEN MATCHED THEN
    UPDATE SET TESTDTA.F4941.RSDSTN=TESTDTA.F4981.FHRTDQ
      
    ,TESTDTA.F4941.RSUMD1=TESTDTA.F4981.FHUOM;

    Finally managed to do work, adding DISTINCT to select.  I have pasted the SQL error in Google to begin with.  Laughing out loud!

    Code snippet work for anyone who comes across this thread...

    MERGE INTO TESTDTA. F4941 DST

    USING (SELECT DISTINCT TESTDTA. F4941. RSSHPN,

    TESTDTA. F4941. RSDSTN,

    TESTDTA. F4941. RSUMD1,

    TESTDTA. F4941. RSADDJ,

    TESTDTA. F4981. FHSHPN,

    TESTDTA. F4981. FHRTDQ,

    TESTDTA. F4981. FHUOM,

    TESTDTA. F4981. FHCGC1

    OF TESTDTA. F4941

    JOIN INTERNAL TESTDTA. F4981

    ON TESTDTA. F4941. RSSHPN = TESTDTA. F4981. FHSHPN

    WHERE - TESTDTA. F4941. RSSHPN = 647143 AND

    TESTDTA. F4941. RSDSTN = 0

    AND TESTDTA. F4941. RSADDJ > 110365

    AND TESTDTA. F4981. FHCGC1 = 'SAY') CBC

    on (DST. RSSHPN = SRC. FHSHPN)

    When matched then update

    SET DST. RSDSTN = SRC. FHRTDQ, SUMMER TIME. RSUMD1 = SRC. FHUOM;

    Thanks to everyone who helped with this.

  • Configuration problem of the mixture of the regions with and without installation of persistence of the disc causing the JSONFormatter to fail

    I have trouble setting my local setup correctly with a mixture of regions with different configuration of persistence of disc.  Is a configuration problem on my end or a bug in GemFire and/or Spring GemFire data?

    The configuration of my work is as follows:

    < gfe: replicated-region id = "replicatedRegion" cache-ref = "gemfireCache" disk-store-ref = "overflowOnlyDiskstore" persistent = "false" >

    < gfe:eviction type = threshold "HEAP_PERCENTAGE" = "90" action = "OVERFLOW_TO_DISK" / >

    < / gfe: replicated-region >

    < gfe:local - region id = "localRegion" cache-ref = "gemfireCache" / >


    With the above configuration, I can successfully call JSONFormatter.fromJSON (json) and get a reference to a PdxInstance object.  However, when I kinda modify configuration to enable the persistence of drive on one of the regions, the call to JSONFormatter.fromJSON (json) fails.  The change is as follows:


    < gfe:local - region id = "localRegion" cache-ref = "gemfireCache" persistent = "true" disk-store-ref = "persistOverflowDiskstore"/ >

    Without any additional modification, the following error starts occurring:

    com.gemstone.gemfire.pdx.JSONFormatterException: could not parse JSON document: [Source: java.io.StringReader@5549f0e, line: column 26,: 6]

    at com.gemstone.gemfire.pdx.JSONFormatter.fromJSON(JSONFormatter.java:66)

    ...

    Caused by: com.gemstone.gemfire.pdx.PdxInitializationException: The PDX metadata must be persistent in a limb that has persisted data. See CacheFactory.setPdxPersistent.

    at com.gemstone.gemfire.pdx.internal.PeerTypeRegistration.checkAllowed(PeerTypeRegistration.java:531)

    at com.gemstone.gemfire.pdx.internal.PeerTypeRegistration.verifyConfiguration(PeerTypeRegistration.java:515)

    ...

    Note that it is breaking while I try to get a reference to a PdxInstance, and if the code has not yet arrived at the point where I place a PdxInstance object in a region.

    Thanks for any help in advance.

    Hello

    JSONFormatter PDX uses as is the serialization mechanism from the Gemfire cache. As indicators of error, you must have your persistent PDX meta-data when you use PDX with an area that itself is persistent. Adjust your configuration as follows:

    
    

    It will use a default for PDX record store, but you can also use a specific store if you wish.

    When you use PDX, a "PDXType" is created for each class serialized with PDX and this type id is stored with the data in the region. If this region is persistent, then the PDXType, associated with this object must also be kept.

    -Jens

Maybe you are looking for