Simple Serializable demo with problems

Hello!
I am having a very simple demo where I tried to see how the Serializable interface works. However, I am receiving message NotSerializableException. What's wrong?
Thanks in advance!
Kind regards,
Igor
Here's the demo:
import java.io.*;
public class SerializationDemo {
  private class Data implements Serializable {
    String someString = "This is a string";
    double someDouble = 1;
  public SerializationDemo() {
    try {
      FileOutputStream fos = new FileOutputStream("dataObjectSerialized");
      ObjectOutputStream oos = new ObjectOutputStream(fos);
      oos.writeObject(new Data());
      fos.close();
    catch (Exception e) {
      System.out.println(e.toString());
  static public void main(String args[]) {
    SerializationDemo demo = new SerializationDemo(); 
};

Consider the following code. What do you expect Child.foo() to print? Why? Supposing you made it serializable, how would you expect it to behave when deserialized?
public class Illustration {
   public Illustration(int x) {
      this.x = x;
      this.c = new Child();
   public void foo() {
      c.foo();
   private Child c;
   private int x;
   private class Child {
      public Child() {
      public void foo() {
         System.out.println(x);
   public static void main(String[] argv) {
      Illustration i = new Illustration(42);
      i.foo();
}In case that's not clear, here's a quick illustration:
public class Illustration {
   public class Child { ... }
+--------------+
| Illustration |
|              |
|  +-----+     |
|  |Child|     |
|  +-----+     |
|              |
+--------------+
public class Illustration {
   public static class Child { ... }
+--------------+
| Illustration |    +-----+
|              |--->|Child|
|              |    +-----+
|              |
|              |
|              |
+--------------+Because Child is not declared static, it has full access to all of the fields of Illustration. Therefore if you serialize it in order to work after deserialization as it did before, it must have copies of all of the owning class's fields.
When you declare it static you break this relationship and it becomes independent.
So taking your following question:
Why is this so? Does this mean that the following two statements would produce completely identical results, providing that SerializationDemo class was made Serializable:
oos.writeObject(new Data());
oos.writeObject(this);No, not quite - the first form creates a new Data object, serializes that, then (of necessity) serializes the owning class as well.
The second form just serializes the current class - since it doesn't have an associated Data object, nothing else gets serialized.
To achieve the effect you want, either make your Data class static, or declare it in its own file (which is roughly the same thing).
Dave.

Similar Messages

  • Simple serialization question with objects

    Hi, I'm really new to the whole concept of serialization and what I want to do is create a blackjack game that can have up to 4 people playing, connected to a server that will act as the dealer. I need to be able to serialize some objects from the players to the server and have the server make some changes then send the objects back.
    However every example I've run across dealing with something of this nature involves writing to a file so I'm not sure what the code to do this would look like.
    My best guess would be ObjectInputStream and ObjectOutputStream but I don't understand how I can tell these streams that I just want to send the serialized object back and forth.
    If anyone could explain to me a bit better how these streams work, or show me roughly what the code might look like, I would really appreciate it.

    It doesn't matter whether you write to a file or a socket or a byte array or whatever. That stuff is what's under the ObjectOutputStream. When you create the OOS, you wrap it around some other stream (e.g. a FileOutputStream in the examples you're talking about I guess). To send something to a server, you'd instead just wrap it around the OutputStream of a Socket that's talking to that server. Everything else is the same.
    Whether you use raw sockets or some other means is up to you, but that's completely separate from the serialize/deserialize process.
    http://java.sun.com/docs/books/tutorial/essential/io/index.html
    http://java.sun.com/docs/books/tutorial/networking/sockets/index.html

  • Problem in simple filetofile scenario with BPM

    Hi
    I am a starter to XI. I am implementing simple file2file scenario with BPMs.
    But I am getting error while looking into SXMB_MONI.
    Under "Monitor for Processed XML messages"
    Number of XML message Found 3 (which is my input 3 xmls which is fine) but
    "Status is RED Flag".
    "Error Category: BPE_ADAPTER"
    "Error ID: UNKNOWN_MESSAGE".
    Please help me out with this problem.
    Regards
    Sam

    Hi Raj,
    When i click PE getting following error:
    "Unable to perform action for selected message".
    When i double click the row, it takes me to xml message versions where i can RED FLAG for "Call Adapter". In the trace i foudn the below at the end:
    <trace level =1 type=system error> error exception return from pipeline processing"</trace>
    Hope this helps to guide me mroe
    sam

  • Problem with central build of Simple Date Type with Enumeration

    Dear gurus,
    I hope I'm posting this in the correct forum. Please advise if I'm in the wrong forum.
    I have a Web Dynpro DC in which I've created a simple data type with enumeration.  It is used for binding to a radio box. The data type is called DownloadType; the enumeration contains two vales: current and archive. To allow me to access the enumeration values, I turn on the "Generate a class representation of the enumeration" in the data type builder.
    I then reference the enumeration values with code like:
    if (downloadType.equals (DownloadType._CURRENT))
        yada yada yada
    This works fine when building locally and deploying directly. But when the DC is built by CBS (or doing a "Development Component->Build..." in NW Dev Studio), the build fails, stating that the DownloadType._CURRENT symbol cannot be resolved.
    For example:
    C:yadayadayada.java:227: cannot resolve symbol
    symbol  : variable _CURRENT
    location: class yadayadayada.DownloadType
                    equals(DownloadType._CURRENT))  {
    Apparently the central builder is not smart enough to handle the "Generate a class representation" flag.
    Is this a known problem? Are there any workarounds?
    Thanks in advance for any help you can provide.
    -Kelly
    P.S. Environment: 2004s

    Hi Kelly,
    works for me using SP10, what SP are you on?
    There's a line in the DC log that says:
         [ddgen] [Info]    Generating datatypes/com/x/x/x/MyEnum.java
    and the java compiler includes the matching path for compilation:
          [echo]   source paths:
          [echo]     ...\_comp\src\packages
          [echo]     ..\t\ABF37B5AFB3B2E8A76FFD29E7862EA48\gen_ddic\datatypes
    Regards,
    Marc

  • Serialization error with WS session bean

    Hi,
    I'm running into a serious problem here at my project and I cannot find out what is going wrong.
    I've made a scaled down version of the project I'm working on. This project gives the exact same error as in the main project.
    I've created some simple POJO's with the model that should be returned by the session bean.
    When I add some random test data and test the webservice I get the following error.
    <faultstring>Internal Server Error ( serialization error : no serializer is registered for ( class nl.mk.test.canonicalmodel.ListObject, null )) </faultstring>
    The model I use looks like this :
    MainObject --> ListArrayObject --> ListObject
    The implementation of these files.
    package nl.mk.test.canonicalmodel;
    import java.io.Serializable;
    public class MainObject implements Serializable{
    public MainObject() {
    public String identification;
    public ListArrayObject somelist;
    package nl.mk.test.canonicalmodel;
    import java.io.Serializable;
    import java.util.List;
    public class ListArrayObject implements Serializable{
    public ListArrayObject() {
    public String someId;
    public List<ListObject> someList;
    package nl.mk.test.canonicalmodel;
    import java.io.Serializable;
    public class ListObject implements Serializable {
    public ListObject() {
    public ListObject(String ident, String testfield1,
    String testfield2, String testfield3
    this.ident = ident;
    this.testfield1 = testfield1;
    this.testfield2 = testfield2;
    this.testfield3 = testfield2;
    public String ident;
    public String testfield1;
    public String testfield2;
    public String testfield3;
    The testWSBean that I've written looks like this.
    package testws;
    import java.util.ArrayList;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import nl.mk.test.canonicalmodel.ListArrayObject;
    import nl.mk.test.canonicalmodel.ListObject;
    import nl.mk.test.canonicalmodel.MainObject;
    import org.apache.log4j.Logger;
    @Stateless(name="TestWSBean")
    public class TestWSBeanBean implements TestWSBean, TestWSBeanLocal,
    TestWSBeanWebService {
    private EntityManager em;
    * Private logging instance
    private static final Logger log = Logger.getLogger(TestWSBean.class);
    public TestWSBeanBean() {
    public MainObject GeefWaarde(String testWaarde) {
    MainObject result = new MainObject();
    long fStart;
    fStart = System.currentTimeMillis();
    try {
    log.debug("----------------------------");
    result.identification = testWaarde;
    ListArrayObject listarray = new ListArrayObject();
    listarray.someId = "ABCDEF";
    List<ListObject> listObj = new ArrayList<ListObject>();
    ListObject listType1 = new ListObject();
    listType1.testfield1 = "A";
    listType1.testfield2 = "B";
    listType1.testfield3 = "C";
    listObj.add( listType1 );
    ListObject listType2 = new ListObject();
    listType2.testfield1 = "D";
    listType2.testfield2 = "E";
    listType2.testfield3 = "F";
    listObj.add ( listType2);
    listarray.someList = listObj;
    result.somelist = listarray;
    catch (Exception e) {
    log.error(e.getMessage());
    e.printStackTrace();
    } finally {
    log.debug("Ready to return results");
    long fEnd;
    fEnd = System.currentTimeMillis();
    log.debug("time in ms : " + (fEnd - fStart));
    return result;
    Does anyone know why this testproject gives a Serializable error?
    Thanks in advance

    Issue with the classes generated on fly for internal use. Make sure all the related files you are using are compiled on the same version of weblogic which you are using(though not mandate).
    Compile and bind the application again, and before redeploying the application, clear cache and temp.
    Hope this helps.
    Jeets.

  • How use to simple Java client with Https ?

    Experts,
    I am having some difficulties to call a https webservice on DataPower.
    The following simple client has no problem to call HTTP webservice but HTTPs different story. SoapUI works just fine with Https request.
    Can any one make a suggestion ? Appreciate any help !
    public final static String DEFAULT_SERVER
    = "https://123.123.123.123:443/Wsp";
    // = "https://123.123.123.123:2048";
    public final static String SOAP_ACTION
    = "http://mycompany.com/Inquiry";
    public static void main(String[] args) {
              String server = DEFAULT_SERVER ;
              String input1 = "123";
              String input2 = "hello";
              try {
              URL u = new URL(server);
              URLConnection uc = u.openConnection();
              HttpURLConnection connection = (HttpURLConnection) uc;
              connection.setDoOutput(true);
              connection.setDoInput(true);
              connection.setRequestMethod("POST");
              connection.setRequestProperty("SOAPAction", SOAP_ACTION);
              OutputStream out = connection.getOutputStream();
              Writer wout = new OutputStreamWriter(out);
              wout.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
              wout.write("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sam=\"http://aglc.com/sampleDp\">\r\n");
              wout.write("<soapenv:Header/>\r\n");
              wout.write("<soapenv:Body>\r\n");
              wout.write("<sam:AcordRequest>\r\n");
              wout.write("<sam:TRANSID>" + input1 + "</sam:TRANSID>\r\n");
              wout.write("<sam:TRANSBODY>" + input2 + "</sam:TRANSBODY>\r\n");
              wout.write("</sam:AcordRequest>\r\n");
              wout.write("</soapenv:Body>\r\n");
              wout.write("</soapenv:Envelope>\r\n");
              wout.flush();
              wout.close();
              String hhResponse ="";
              InputStreamReader isr = new InputStreamReader(connection.getInputStream());
              BufferedReader in = new BufferedReader(isr);
              String inputLine;
              while ((inputLine = in.readLine()) != null){
              //AIGTraceLog.log(componentName,Level.INFO,inputLine);
              hhResponse = hhResponse+inputLine+"\n";
              System.out.println(hhResponse);
              in.close();
              catch (IOException e) {
              System.err.println(e);
              }

    Thanks for the reply. I think I am close, based on your instruction, I did the following but still got the same error.
    C:\Program Files\Java\j2re1.4.2_13>java com.mypack.testdpws.TestDPWS
    javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificate not Trusted
    C:\Program Files\Java\j2re1.4.2_13>keytool -import -alias testDPWS -file TestDpClSsl.crt
    Enter keystore password:
    Enter keystore password: password
    Owner: CN=TestDpClSsl
    Issuer: CN=TestDpClSsl
    Serial number: 2dd2d12e
    Valid from: 12/1/10 4:37 PM until: 12/1/11 4:37 PM
    Certificate fingerprints:
    MD5: 3A:89:FE:76:BC:30:BF:F0:87:31:F5:14:29:07:60:91
    SHA1: 40:71:51:4C:84:BD:08:40:A6:7D:60:A8:A8:04:BA:09:B7:E5:C9:A4
    Trust this certificate? [no]: y
    Certificate was added to keystore
    C:\Program Files\Java\j2re1.4.2_13>java com.mypack.testdpws.TestDPWS
    javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificate not Trusted
    Any idea ? or do I need to add something in the test program ?

  • Simple Finder/Parental Controls Problem

    I recently did an erase and install on my eMac and am now having problems with Simple Finder and Parental Controls.
    I have an account set up for my daughter and I want to have Simple Finder running with about a half dozen or so applications for her to use. Prior to the erase-and-install, I had this set up and running fine. But now, even though I select all the programs I want under the Parental Controls preferences, only three show up (Safari, Dictionary, and TextEdit).
    I tried deleting and re-creating the account, repairing permissions, turning around twice and clicking my heels together, etc. with no success.
    Any ideas? Thanks!

    I ran disk utility and repaired the permissions--is that similar to what you suggest?
    When I did a erase-and-install of Leopard, I assume that it ran through a disk inspection and repair routine. But perhaps something more is needed.

  • Yes another user with problem with Apple Mobile Device Support, I am getting the error message: Service 'Apple Mobile Device'(Apple Mobile Device) failed to start. Vertify that you have sufficient privileges to start system service....

    Yes another user with problem with Apple Mobile Device Support, I am getting the error message: Service 'Apple Mobile Device'(Apple Mobile Device) failed to start. Vertify that you have sufficient privileges to start system service....I hit retry and it came up again. I hit ignore and it prompted me to hit finish so Itunes can open.   I looked thru alot of these posts on here to try and resolve this problem myself but it's not working too well...I downloaded Itunes to my desktop so I can right click it with the program i downloaded called WinRAR. I extracted it and then went into the folder called Itunes64setup. I saw the file called AppleMobileDeviceSupport64 in there so I began to try and download it on it's own. Well that didn't work as I planned and got this error message:
    Apple Mobile Device Support wasn't installed on your computer. The installer encountered errors before Apple Mobile Device Support could be configured. Your system has not been modified. To retry these operations at a later time,please run the installer again.
    Well I tried to run it again and came up with the same message...I see that some people got great support to help them so I am hoping someone can help me as well. I know "b nor" is very qualfied and hopefully can help me! Please advise what I can do. Thank you

    Hi Iss9243,
    Welcome to the Support Communities!
    You've already tried some great troubleshooting steps, but the article below gives you quite a few more for this issue.  Hope it helps ....
    iTunes 11.1.4 for Windows: Unable to install or open
    http://support.apple.com/kb/TS5376
    Cheers,
    - Judy

  • If pdf generated with Bullzip, opens with problems in text (missing, weird characters, etc...)

    pdf opening in new tab shows problems with text. If pdf was generated with Adobe acrobat, works fine. If pdf generated with Bullzip, opens in new tab, but with problems.

    hello lwhitman, the pdf preview in firefox is still under very active development. if you find any issues please report them at https://github.com/mozilla/pdf.js/issues & provide a sample pdf-file which shows the problem.

  • I Am Using iphone 5 black 16 gb with problem of battery expansion in a year.?

    i Am Using iphone 5 black 16 gb with problem of battery expansion in a year.?

    What is your question?

  • JDK 1.5 Serialization Compatibility with assert()

    I have the following class:
    class xyz implements java.io.Serializable {
       void doNothing() {
          int x = 0;
          assert x < 5;
    }If I compile it on both JDK 1.4 (with -source=1.4) and 1.5 (with -source=1.5) platforms, the serialVersion IDs are different. If I comment out the assert statement, the serialVersion on 1.5 platform changes to be the same as the 1.4. If I rebuild the 1.4 with the assert commented out, the serialVersionID does not change.
    Am I missing something here? I have code that needs to be compatible between these versions, but it now seems that the use of assert (other than the statment "assert true") built with 1.5 effects the serialization ID.

    Sure, I can define my own version, but the point is that I've got many fielded classes that have not changed, but now will fail serialization when comunicating with the new system simply because of the use of assertions with 1.5.
    It looks like I will be forced to either go back to 1.4, test all classes for serialization compatibility with 1.4, or remove the asserts from the code.
    In any case, it does not make sence to me why adding an assertion should change the serialVersionUID of a class in the first place when compiling under 1.5 and not under 1.4.

  • I have an iMac that I purchased back in 2010 and over the past 9 month or less my computer just started shutting down while someone was in the process or working on it.  What could this come from?  Is there a simple solutions to this problem?

    I have an iMac that I purchased back in 2010 and over the past 9 month or less my computer just started shutting down while someone was in the process or working on it.  What could this come from?  Is there a simple solutions to this problem?

    Which model iMac do you have?  http://support.apple.com/kb/HT1758 How to identify iMac models 
    Which OS is currently installed? 
    Check out KB Articles:  http://support.apple.com/kb/HT3964 Intel-based Macs: Resetting the System Management Controller (SMC) and http://support.apple.com/kb/HT1379 Resetting your Mac's PRAM and NVRAM 
    If not of the above works and you have AC, call them.  Let them deal w/it.  Otherwise, take your iMac down to your local AS or an AASP.  Diagnostic testing is FREE! 
    You can also research for a solution on YouTube's "How To" website and iFixit. 

  • HT1933 Good all, is there anyone with problem on the whatsapp 2.11.6 version. It's was crashing on my iPhone. I thought these software was first tested before uploading.

    Good all, is there anyone with problem on the whatsapp 2.11.6 version. It's was crashing on my iPhone. I thought these software was first tested before uploading.

    Looking at the reviews for the current version of the app in the app store it looks like other people are also having problems with it - you could try contacting the developers of the app : http://www.whatsapp.com/contact/

  • Simple test case with NL and table order .

    Hi,
    did some tests on my 9.2.0.8 and got few questions:
    SQL> select count(*)  from p;
      COUNT(*)
          2000
    SQL> select count(*)  from c;
      COUNT(*)
          1000
    SQL> select count(*) , id from p group by id having count(*) > 1;
    no rows selected
    SQL> select count(*) , id from c group by id having count(*) > 1;
      COUNT(*)         ID
           100         10
    SQL> desc p
               Name
        1      ID number
        2      FILLER varchar2(100)
    SQL> desc c
               Name
        1      ID number
        2      FILLER varchar2(100)
    Got 10046 traces:
    case A
    select /*+ use_nl(p) leading(c) */ *
    from
    p , c where p.id = c.id and c.id in (10)
    Rows     Row Source Operation
        100  TABLE ACCESS BY INDEX ROWID P
        201   NESTED LOOPS
        100    TABLE ACCESS BY INDEX ROWID C
        100     INDEX RANGE SCAN C_ID (object id 411255)
        100    INDEX RANGE SCAN P_ID (object id 411256)
    Case B optimal
    select /*+ use_nl(c) leading(p) */ *
    from
    p , c where p.id = c.id and c.id in (10)
    Rows     Row Source Operation
        100  TABLE ACCESS BY INDEX ROWID C
        102   NESTED LOOPS
          1    TABLE ACCESS BY INDEX ROWID P
          1     INDEX RANGE SCAN P_ID (object id 411256)
        100    INDEX RANGE SCAN C_ID (object id 411255)So its simple nested loop with postponed inner table access .
    Why in row source operation we have got 102 rows (NL level) ? (It means NL was executed 102 times ?)
    And why 201 in other case ?
    Regards
    GregG

    I am not sure about the calculation/reason for those A-ROWS figures but the NL operation executes only once (but accesses inner rowsource 100 times in case one and once in second case) in both cases (which is as expected).
    A closer test case (to OP) is
    SQL> select * from v$version ;
    BANNER                                                                                                                                                                    
    Oracle Database 10g Release 10.2.0.5.0 - Production                                                                                                                       
    PL/SQL Release 10.2.0.5.0 - Production                                                                                                                                    
    CORE     10.2.0.5.0     Production                                                                                                                                                
    TNS for Linux: Version 10.2.0.5.0 - Production                                                                                                                            
    NLSRTL Version 10.2.0.5.0 - Production                                                                                                                                    
    SQL> create table p nologging as select level as id, cast(dbms_random.string('a', 100) as varchar2(100)) as filler from dual connect by level <= 2000 ;
    Table created.
    SQL> exec dbms_stats.gather_table_stats(user, 'P') ;
    PL/SQL procedure successfully completed.
    SQL> create index p_id on p(id) nologging ;
    Index created.
    SQL> select count(*)  from p;
      COUNT(*)                                                                                                                                                                
          2000                                                                                                                                                                
    SQL> select count(*) , id from p group by id having count(*) > 1;
    no rows selected
    SQL> create table c nologging as select level as id, cast(dbms_random.string('a', 100) as varchar2(100)) as filler from dual connect by level <= 900 union all select 10, cast(dbms_random.string('a', 100) as varchar2(100)) as filler from dual connect by level <= 99 ;
    Table created.
    SQL> select count(*) , id from c group by id having count(*) > 1;
      COUNT(*)         ID                                                                                                                                                     
           100         10                                                                                                                                                     
    SQL> exec dbms_stats.gather_table_stats(user, 'C') ;
    PL/SQL procedure successfully completed.
    SQL> create index c_id on c(id) nologging ;
    Index created.
    SQL> select /*+ use_nl(p) leading(c) gather_plan_statistics */ * from p , c where p.id = c.id and c.id in (10) ;
            ID FILLER                                                                                                       ID                                                
    FILLER                                                                                                                                                                    
            10 opKRJynLxjeCiOScvOklQBXfpnfgvlhHNLzlKKrFaNzQLODKSnKMxpzecqyFkVSLvdosZJhWckBcQbpIaqttahlqBxrugKQVrnIk         10                                                
    zrGZSmUFXNyNMOViUYSvPDdfznSlMvaFnQakopPtcBvXQkWmMlWCnrPyeZLfhuLLeYyAEkcwZNSfoASLYpoAnpESqlQWkaEGatXV                                                                      
            10 opKRJynLxjeCiOScvOklQBXfpnfgvlhHNLzlKKrFaNzQLODKSnKMxpzecqyFkVSLvdosZJhWckBcQbpIaqttahlqBxrugKQVrnIk         10                                                
    hKtrWPCfAmWWLGMXfwHCusSwVpehEnZdxYPLouIuBlMMiSKlIJWwklZCAXZaCbIxKlhzBVRhhTPdLcheyAdoYyfxwomqWRrMXuMk                                                                      
            10 opKRJynLxjeCiOScvOklQBXfpnfgvlhHNLzlKKrFaNzQLODKSnKMxpzecqyFkVSLvdosZJhWckBcQbpIaqttahlqBxrugKQVrnIk         10                                                
    ncSqclZvOGgyXDPaaouGaUqXmJtFNbNyFzUalDknEMvTsBRwGmTxOCIalLvqMnuTFBZJGzNfBqaSVHUtvNDceVZqKQQyqeGKOUdz                                                                      
    100 rows selected.
    SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST')) ;
    PLAN_TABLE_OUTPUT                                                                                                                                                         
    SQL_ID  1f55m4rabtu3h, child number 0                                                                                                                                     
    select /*+ use_nl(p) leading(c) gather_plan_statistics */ * from p , c where p.id = c.id and                                                                              
    c.id in (10)                                                                                                                                                              
    Plan hash value: 2553281496                                                                                                                                               
    | Id  | Operation                     | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |                                                                 
    |   0 | SELECT STATEMENT              |      |      0 |        |      0 |00:00:00.01 |       0 |      0 |                                                                 
    |   1 |  TABLE ACCESS BY INDEX ROWID  | P    |      1 |      1 |    100 |00:00:00.01 |     112 |      2 |                                                                 
    |   2 |   NESTED LOOPS                |      |      1 |      1 |    201 |00:00:00.02 |     110 |      2 |                                                                 
    |   3 |    TABLE ACCESS BY INDEX ROWID| C    |      1 |      1 |    100 |00:00:00.01 |       7 |      1 |                                                                 
    |*  4 |     INDEX RANGE SCAN          | C_ID |      1 |      1 |    100 |00:00:00.01 |       3 |      1 |                                                                 
    |*  5 |    INDEX RANGE SCAN           | P_ID |    100 |      1 |    100 |00:00:00.01 |     103 |      1 |                                                                 
    Predicate Information (identified by operation id):                                                                                                                       
       4 - access("C"."ID"=10)                                                                                                                                                
       5 - access("P"."ID"=10)                                                                                                                                                
    24 rows selected.
    SQL> select /*+ use_nl(c) leading(p) gather_plan_statistics */ * from p , c where p.id = c.id and c.id in (10) ;
            ID FILLER                                                                                                       ID                                                
    FILLER                                                                                                                                                                    
            10 opKRJynLxjeCiOScvOklQBXfpnfgvlhHNLzlKKrFaNzQLODKSnKMxpzecqyFkVSLvdosZJhWckBcQbpIaqttahlqBxrugKQVrnIk         10                                                
    zrGZSmUFXNyNMOViUYSvPDdfznSlMvaFnQakopPtcBvXQkWmMlWCnrPyeZLfhuLLeYyAEkcwZNSfoASLYpoAnpESqlQWkaEGatXV                                                                      
            10 opKRJynLxjeCiOScvOklQBXfpnfgvlhHNLzlKKrFaNzQLODKSnKMxpzecqyFkVSLvdosZJhWckBcQbpIaqttahlqBxrugKQVrnIk         10                                                
    hKtrWPCfAmWWLGMXfwHCusSwVpehEnZdxYPLouIuBlMMiSKlIJWwklZCAXZaCbIxKlhzBVRhhTPdLcheyAdoYyfxwomqWRrMXuMk                                                                      
            10 opKRJynLxjeCiOScvOklQBXfpnfgvlhHNLzlKKrFaNzQLODKSnKMxpzecqyFkVSLvdosZJhWckBcQbpIaqttahlqBxrugKQVrnIk         10                                                
    ncSqclZvOGgyXDPaaouGaUqXmJtFNbNyFzUalDknEMvTsBRwGmTxOCIalLvqMnuTFBZJGzNfBqaSVHUtvNDceVZqKQQyqeGKOUdz                                                                      
    100 rows selected.
    SQL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST')) ;
    PLAN_TABLE_OUTPUT                                                                                                                                                         
    SQL_ID  7hvf1zvsvfhdp, child number 0                                                                                                                                     
    select /*+ use_nl(c) leading(p) gather_plan_statistics */ * from p , c where p.id =                                                                                       
    c.id and c.id in (10)                                                                                                                                                     
    Plan hash value: 2133717140                                                                                                                                               
    | Id  | Operation                     | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |                                                                          
    |   0 | SELECT STATEMENT              |      |      0 |        |      0 |00:00:00.01 |       0 |                                                                          
    |   1 |  TABLE ACCESS BY INDEX ROWID  | C    |      1 |      1 |    100 |00:00:00.01 |      11 |                                                                          
    |   2 |   NESTED LOOPS                |      |      1 |      1 |    102 |00:00:00.01 |       7 |                                                                          
    |   3 |    TABLE ACCESS BY INDEX ROWID| P    |      1 |      1 |      1 |00:00:00.01 |       4 |                                                                          
    |*  4 |     INDEX RANGE SCAN          | P_ID |      1 |      1 |      1 |00:00:00.01 |       3 |                                                                          
    |*  5 |    INDEX RANGE SCAN           | C_ID |      1 |      1 |    100 |00:00:00.01 |       3 |                                                                          
    Predicate Information (identified by operation id):                                                                                                                       
       4 - access("P"."ID"=10)                                                                                                                                                
       5 - access("C"."ID"=10)                                                                                                                                                
    24 rows selected.
    SQL> drop table p purge ;
    Table dropped.
    SQL> drop table c purge ;
    Table dropped.
    SQL> spool offEdited by: user503699 on Jan 18, 2012 11:49 PM

  • Simple spatial query with different SRID

    Can anyone help me with just a real simple spatial query with different SRID.
    Here is the error i get when i perform the query:
    AND SDO_RELATE(A.geometrie_point, B.GEOMETRIE_POLYGONE, 'mask=anyinteract querytype=WINDOW') = 'TRUE'
    ERROR at line 4:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-13207: incorrect use of the [IN COMPATIBLE BOUNDS in SDO_RELATE] operator
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 84
    ORA-06512: at line 4

    Hi,
    I am using 8.1.7.2 and i have the lattest spatial patch.
    From the start i had different SRID. The only thing i changed was the bounds of the coordinate system.
    I reset my bounds of the coordinate system with SRID 8307 to -180,
    180 in X (longitude), and -90,90 in Y (latitude) to see if the query window geometry
    (geom2) will be transformed to the coordinate system of the layer geometries (geom1)
    Her is the content of the user_sdo_geom_metadata :
    GIS_PCP GEOMETRIE_POINT
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -5800000, 3600000, .00000005), SDO_DIM_ELEMENT('Y', 3516000, 6000000, .00000005))
    82227
    GIS_TEST GEOMETRIE_POLYGONE
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -180, 180, .00000005), SDO_DIM_ELEMENT('Y', -90, 90, .00000005))
    8307
    Here is my query :
    select /*+ ordered */ A.no_point
    from gis_pcp A, gis_test B
    WHERE SDO_RELATE(A.geometrie_POINT, B.GEOMETRIE_POLYGONE, 'mask=anyinteract querytype=WINDOW') = 'TRUE';
    Here is my result :
    WHERE SDO_RELATE(A.geometrie_POINT, B.GEOMETRIE_POLYGONE, 'mask=anyinteract querytype=WINDOW') = 'TRUE'
    ERROR at line 3:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-13207: incorrect use of the [IN COMPATIBLE BOUNDS in SDO_RELATE] operator
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 84
    ORA-06512: at line 4
    If i change the bounds of GIS_TEST to the exact bouns of GIS_PCP then i dont have the error message above and i have correct results. Do i have the adjust the bounds of every layer to fit the biggest bound?

Maybe you are looking for