#9 Persistent objs created with 'create as' may be transient
Posted: Thu Jan 27, 2011 12:45 pm
In JADE 6.3 it is possible for objects to be created with the wrong persistence when the 'create as' syntax is used and the persistence is not explicitly specified.
The issue is documented in JADE par #55301.
Description:
This applies to any JADE database that has been, or will be upgraded to 6.3, where:
This could go undetected at runtime. One symptom though is the occurrence of a 1215 error (Persistent objects cannot reference transient objects) if a transient object is referenced by a persistent object that presumes it to be persistent.
Product Resolution:
Hotfix 6.3.07.10 has been released that provides a mechanism for recompiling affected methods after the upgrade. This fix is also present in the JADE 6.3.08 release.
The RootSchema method: Schema::_fixCreateAs() will find any JADE methods that use 'create <object> as <variable>' in any schema and recompile them.
It is sufficient to run this fix once per JADE system (instructions for doing this are given below).
Running ::fixCreateAs() will create a file called 'FixCreateAs.log' in the system log directory that lists all such methods successfully compiled and any methods that failed to compile.
The file output is of the following form:
To run the method, create and run a JadeScript method as follows:
Other Considerations:
If access to the target environment's IDE is not available the fix may be run in batch mode, e.g.
The issue is documented in JADE par #55301.
Description:
This applies to any JADE database that has been, or will be upgraded to 6.3, where:
- The application creates instances of user objects using the 'as' clause in the create instruction, and
- The type to be created is variable and not an explicit class, and
- The ‘Persistent’ keyword is not used to explicitly create the object as a persistent one
Code: Select all
createEmployee(entity : Employee io; cls : Class) updating;
begin
create entity as cls; // an issue after upgrading to 6.3
- The issue does not manifest for object creates not using the ‘as’ clause
- The issue does not manifest for object creates that use the keyword persistent/transient’
- The issue does not manifest for object creates where the type is explicitly stated
Code: Select all
create entity; //not an issue
create entity as type persistent; //not an issue
create entity as SalariedEmployee; //not an issue
Hotfix 6.3.07.10 has been released that provides a mechanism for recompiling affected methods after the upgrade. This fix is also present in the JADE 6.3.08 release.
The RootSchema method: Schema::_fixCreateAs() will find any JADE methods that use 'create <object> as <variable>' in any schema and recompile them.
It is sufficient to run this fix once per JADE system (instructions for doing this are given below).
Running ::fixCreateAs() will create a file called 'FixCreateAs.log' in the system log directory that lists all such methods successfully compiled and any methods that failed to compile.
The file output is of the following form:
Note that you do not need to be concerned by reported fixes for non user schemas (such as the JadeReportWriterSchema schema).Checking for methods that use create as variable...
Checking for create as <variable> statements complete, errors: 0
methods with create as <variable> statements: 1
methods recompiled successfully: 1
methods with compile errors: 0
The following methods were successfully compiled:
Contact55301::EmployeeFactory::createEmployee
To run the method, create and run a JadeScript method as follows:
Code: Select all
fixCreateAs();
begin
currentSchema._fixCreateAs();
end;
If access to the target environment's IDE is not available the fix may be run in batch mode, e.g.
If the target environment is source stripped then source will need to be loaded before the _fixCreateAs() method is executed. This is because the fix requires that source in order to recompile any affected methods. An alternative solution is to perform a schema load of affected methods after the upgrade and ensure that those methods are recompiled by specifying the CompileUnchangedMethods option in the jadloadb.exe invocation.jadloadb.exe path=<Path> ini=<IniFile> server=singleUser executeSchema=RootSchema executeClass=Schema executeMethod=_fixCreateAs endJade