A script-enabled browser is required for this page to function properly.

Understanding the Persistent Naming Option

Regardless of whether the Generate persistent names option is selected in the Import Java Class Options dialog box, the importer creates unique names for all functions and procedures in the PL/SQL package. But the default names (if the Generate persistent names option is not selected) and persistent names differ.

What is standard naming?

With standard naming, functions and procedures are generated to the same name as the corresponding Java method, provided the function and procedure names can be unique. In the case of overloaded Java methods where the generated PL/SQL function and procedure names cannot be resolved to unique PL/SQL signatures, the importer appends an incremental identifier to the function or procedure name.

Example 1

Start with the following Java class:



Class myclass
{
   public void p1(int x);
   public void p1(long x);
   public void p1(char x);
}

Import the class with the Java Importer. Without persistent naming (Generate persistent names is not selected), the resulting PL/SQL for the above methods is the following:



-- Method: p1 (C)V
PROCEDURE p1 (
   obj   ORA_JAVA.JOBJECT,
   a0    PLS_INTEGER);


-- Method: p1 (I)V
PROCEDURE p1_1 (
   obj   ORA_JAVA.JOBJECT,
   a0    NUMBER);


-- Method: p1 (J)V
PROCEDURE p1_2 (
   obj   ORA_JAVA.JOBJECT,
   a0    NUMBER);

Note that the procedures were not generated in the order the Java methods appear in the Java class file. The order for the above PL/SQL procedures correspond to the Java methods in this sequence:



   public void p1(char x);
   public void p1(int x);
   public void p1(long x);

Example 2

The following example uses the previous Java class, but with one method—p1(long x)—removed. Start with the following Java class:



Class myclass
{
   public void p1(int x);
   public void p1(char x);
}

Import the class with the Java Importer. Without persistent naming (Generate persistent names is not selected), the resulting PL/SQL for the above methods is the following:



-- Method: p1 (C)V
PROCEDURE p1 (
   obj   ORA_JAVA.JOBJECT,
   a0    PLS_INTEGER);
   

-- Method: p1 (I)V
PROCEDURE p1 (
   obj   ORA_JAVA.JOBJECT,
   a0    NUMBER);

Note that both procedures are called p1. Because each has a unique signature, the importer resolved each method to a unique procedure signature and did not append an identifier. Note that the removal of a method from the Java class affected the names of the generated procedure names.

What is persistent naming?

Persistent naming forces a persistent and unique four-digit identifier appended to the end of all function or procedure names. As long as Generate persistent names remains selected each time you generate PL/SQL from a Java class—even if the Java class has changed—the functions and procedure names (including appended identifiers) remain the same.

The persistent identifier numbers are generated based on the method signature. With Generate persistent names selected, each time the same Java class is imported with the Java Importer, the PL/SQL functions and procedures generated for the same Java methods will have the same four-digit identifiers.

Persistent naming is recommended if the Java class you are importing will change and you want to use the same persistent PL/SQL function, procedure, variable, and type names throughout all the changes to the Java class. (Note: You must regenerate the PL/SQL package to access the Java class changes in PL/SQL.)

Example 3

Start with the following Java class:



Class myclass
{
   public void p1(int x);
   public void p1(long x);
   public void p1(char x);
}

Import the class with the Java Importer. With persistent naming (Generate persistent names is selected), the resulting PL/SQL for the above methods is the following:



-- Method: p1 (C)V

PROCEDURE p1_7384 (
  
  obj   ORA_JAVA.JOBJECT,
  a0    PLS_INTEGER);


-- Method: p1 (I)V
PROCEDURE p1_3150 (
   obj   ORA_JAVA.JOBJECT,
   a0    NUMBER);


-- Method: p1 (J)V
PROCEDURE p1_4111 (
   obj   ORA_JAVA.JOBJECT,
   a0    NUMBER);

Note that all of the procedure names include a unique four-digit identifier appended to the name.

Example 4

The following example uses the previous Java class, but with one method—p1(long x)—removed. Start with the following Java class:



Class myclass
{
   public void p1(int x);
   public void p1(char x);
}

Import the class with the Java Importer. With persistent naming (Generate persistent names is selected), the resulting PL/SQL for the above methods is the following:



-- Method: p1 (C)V
PROCEDURE p1_7384 (

   obj   ORA_JAVA.JOBJECT,
   a0    PLS_INTEGER);



-- Method: p1 (I)V
PROCEDURE p1_3150 (

   obj   ORA_JAVA.JOBJECT,
   a0    NUMBER);

Note that all of the procedure names include a unique four-digit identifier appended to the name. Note that these identifiers are the same numbers generated in the previous example (Example 3) and that the removal of a method from the Java class did not effect the numbering, and therefore, the names of the procedures.

Naming Rules for Generated PL/SQL