java.lang.Object | +----COM.odi.Session
Your application must create a session. After a session is created, it is an active session. A session remains active until your application or ObjectStore terminates it. After a session is terminated, it is never used again. You can, however, create a new session.
A session consists of a set of persistent objects, and a set of ObjectStore API objects, such as an instance of the Transaction class and instances of the Database class.
Different products allow different numbers of sessions in a single Java VM process:
public static Session create(String host, Properties properties)
This method throws FatalApplicationException if there is an active session.
You can specify the following properties:
COM.odi.applicationName indicates the name of the application for the current client. This allows users of the LockTimeoutBlocker class or the ossvrstat utility to retrieve information about clients involved in concurrency conflicts. When you set this property, it can provide information about your application to other clients.
COM.odi.cacheSize specifies the size of the C++ client cache in bytes. The default is 8388608 bytes, or 0x800000 bytes in hexadecimal. If the value is a String that starts with 0x or 0X, ObjectStore treats the value as a hexadecimal number. ObjectStore rounds the cache size down to the nearest whole number of pages.
COM.odi.disableWeakReferences is a Boolean value that defaults to "false". (Remember that all property values are strings, so you must enclose false or true in quotation marks.) When you specify this property, ObjectStore does not use the weak reference facility.
When you start the first session in a Java process, the setting of the COM.odi.disableWeakReferences property is in effect for the duration of the Java process. If you terminate the session and start another session with a different value for the COM.odi.disableWeakReferences property, the new value is ignored.
A weak reference to an object is a reference that does not prevent the object from being garbage collected by the Java VM's garbage collector. In its internal Object Table, ObjectStore uses weak references to hold references to unmodified persistent objects. If your program does not have any references to a persistent object and the reference in the Object Table is the only reference, the object can be garbage collected. If the persistent object has been modified and the changes have not yet been saved, ObjectStore uses a strong reference to hold the reference to the object. A strong reference prevents the object from being garbage collected.
The COM.odi.migrateUnexportedStrings property controls what happens when ObjectStore encounters a cross-segment reference to an unexported String object. If this property is not set or if it is set to true, ObjectStore creates a new String object that has the same value as the referenced object. ObjectStore places this new string in the same segment as the referring object and substitutes this new string for the referenced string. If this property is set to false, ObjectStore throws ObjectNotExportedException if it encounters a reference to a string in another segment and that string is not exported.
COM.odi.ObjectStoreLibrary specifies the name of the native library that contains the ObjectStore schema and native methods for the application. The name should follow platform conventions for library names. If you do not specify this property, ObjectStore uses the standard library, which provides for primary Java objects but not Java peer objects.
COM.odi.user and COM.odi.password allow you to supply a user name and a password when the ObjectStore Server has Name Password set for the Authentication Required Server parameter.
COM.odi.product allows you to specify which Object Design Java product you want to use. The advantage of COM.odi.product is that it allows you to write an application that copies data among PSE, PSE Pro, and ObjectStore databases. You can set this property to one of the following three values: PSE, PSEPro, or ObjectStore. To use any of these products, you must have the software in your CLASSPATH environment variable. When this property is not set, Object Design software looks for PSE Pro, then PSE, then ObjectStore, and uses the first product it finds.
The setting of COM.odi.product applies only to the session for which it is specified. After you start a session, you cannot change the value of COM.odi.product. An example of how to use this property is in the user guide.
COM.odi.queryDebugLevel allows you to control debugging output when you are using the query facility defined in the COM.odi.util.query.Query class. In PSE, this property does nothing.
The default level is 0, which does not output any information. Set the property to a value greater than 0 to print debugging output to System.err. As the value of this property increases, the query facility outputs more information as follows:
The COM.odi.trapUnregisteredType property is useful for troubleshooting ClassCastExceptions. The default is that this property is not set, and it is usually best to use the default.
When ObjectStore encounters a type for which it does not have information (that is, the type is unregistered), it checks the setting of the COM.odi.trapUnregisteredType property.
If the property is not set, ObjectStore creates an instance of the UnregisteredType class to represent the unknown type. Your application continues to run as long as it does not try to use the UnregisteredType object. Often, this can be fine because your application has no need for that particular field. However, if you do try to use the unregistered type, ObjectStore throws ClassCastException.
If COM.odi.trapUnregisteredType is set, ObjectStore throws FatalApplicationException and provides a message that indicates the name of the unregistered class. See the user guide for additional information.
public static Session create(String host, Properties properties, String name)
This method throws FatalApplicationException if there is an active session.
You can specify the following properties:
COM.odi.applicationName indicates the name of the application for the current client. This allows users of the LockTimeoutBlocker class or the ossvrstat utility to retrieve information about clients involved in concurrency conflicts. When you set this property, it can provide information about your application to other clients.
COM.odi.cacheSize specifies the size of the C++ client cache in bytes. The default is 8388608 bytes, or 0x800000 bytes in hexadecimal. If the value is a String that starts with 0x or 0X, ObjectStore treats the value as a hexadecimal number. ObjectStore rounds the cache size down to the nearest whole number of pages.
COM.odi.disableWeakReferences is a Boolean value that defaults to "false". (Remember that all property values are strings, so you must enclose true and false in quotation marks.) When you specify this property, ObjectStore does not use the weak reference facility.
When you start the first session in a Java process, the setting of the COM.odi.disableWeakReferences property is in effect for the duration of the Java process. If you terminate the session and start another session with a different value for the COM.odi.disableWeakReferences property, the new value is ignored.
A weak reference to an object is a reference that does not prevent the object from being garbage collected by the Java VM's garbage collector. In its internal Object Table, ObjectStore uses weak references to hold references to unmodified persistent objects. If your program does not have any references to a persistent object and the reference in the Object Table is the only reference, the object can be garbage collected. If the persistent object has been modified and the changes have not yet been saved, ObjectStore uses a strong reference to hold the reference to the object. A strong reference prevents the object from being garbage collected.
The COM.odi.migrateUnexportedStrings property controls what happens when ObjectStore encounters a cross-segment reference to an unexported String object. If this property is not set or if it is set to true, ObjectStore creates a new String object that has the same value as the referenced object. ObjectStore places this new string in the same segment as the referring object and substitutes this new string for the referenced string. If this property is set to false, ObjectStore throws ObjectNotExportedException if it encounters a reference to a string in another segment and that string is not exported.
COM.odi.ObjectStoreLibrary specifies the name of the native library that contains the ObjectStore schema and native methods for the application. The name should follow platform conventions for library names. If you do not specify this property, ObjectStore uses the standard library, which provides for primary Java objects but not Java peer objects.
COM.odi.user and COM.odi.password allow you to supply a user name and a password when the ObjectStore Server has Name Password set for the Authentication Required Server parameter.
COM.odi.product allows you to specify which Object Design Java product you want to use. The advantage of COM.odi.product is that it allows you to write an application that copies data among PSE, PSE Pro, and ObjectStore databases. You can set this property to one of the following three values: PSE, PSEPro, or ObjectStore. To use any of these products, you must have the software in your CLASSPATH environment variable. When this property is not set, Object Design software looks for PSE Pro, then PSE, then ObjectStore, and uses the first product it finds.
The setting of COM.odi.product applies only to the session for which it is specified. After you start a session, you cannot change the value of COM.odi.product. An example of how to use this property is in the user guide.
COM.odi.stringPoolSize specifies the maximum size of the persistent string pool. The value of this property specifies the maximum number of newly created strings that ObjectStore can maintain in the string pool. If the number of newly created strings exceeds this number, only the ones that were most recently created and used are tracked by the pool. The default value is 100. Before ObjectStore migrates a string into a segment, it checks the pool to see if a string with the same value is already available in the segment. If it is, the string is reused and ObjectStore does not create a new one. ObjectStore clears the pool at the start of each transaction. You can turn off the pooling mechanism by setting the value of this property to 0.
COM.odi.queryDebugLevel allows you to control debugging output when you are using the PSE Pro query facility defined in the COM.odi.util.query.Query class. In PSE, this property does nothing.
The default level is 0, which does not output any information. Set the property to a value greater than 0 to print debugging output to System.err. As the value of this property increases, the query facility outputs more information as follows:
The COM.odi.trapUnregisteredType property is useful for troubleshooting ClassCastExceptions. The default is that this property is not set, and it is usually best to use the default.
When ObjectStore encounters a type for which it does not have information, it checks the setting of the COM.odi.trapUnregisteredType property.
If the property is not set, ObjectStore creates an instance of the UnregisteredType class to represent the unknown type. Your application continues to run as long as it does not try to use the UnregisteredType object. Often, this can be fine because your application has no need for that particular field. However, if you do try to use the unregistered type, ObjectStore throws ClassCastException.
If COM.odi.trapUnregisteredType is set, ObjectStore throws FatalApplicationException and provides a message that indicates the name of the unregistered class. See the user guide for additional information.
public static Session createGlobal(String host, Properties properties)
There is a bug in the software that prevents a global session from automatically joining threads to the session. To work around this, you must explicitly join threads to a global session. Call the Session.join() method on each thread that you want to be associated with the global session. This bug will be fixed in a future release.
This method throws an exception if there is an active session.
You can specify the following properties:
COM.odi.applicationName indicates the name of the application for the current client. This allows users of the LockTimeoutBlocker class or the ossvrstat utility to retrieve information about clients involved in concurrency conflicts. When you set this property, it can provide information about your application to other clients.
COM.odi.cacheSize specifies the size of the C++ client cache in bytes. The default is 8388608 bytes, or 0x800000 bytes in hexadecimal. If the value is a String that starts with 0x or 0X, ObjectStore treats the value as a hexadecimal number. ObjectStore rounds the cache size down to the nearest whole number of pages.
COM.odi.disableWeakReferences is a Boolean value that defaults to "false". (Remember that all property values are strings, so you must enclose true and false in quotation marks.) When you specify this property, ObjectStore does not use the weak reference facility.
When you start the first session in a Java process, the setting of the COM.odi.disableWeakReferences property is in effect for the duration of the Java process. If you terminate the session and start another session with a different value for the COM.odi.disableWeakReferences property, the new value is ignored.
A weak reference to an object is a reference that does not prevent the object from being garbage collected by the Java VM's garbage collector. In its internal Object Table, ObjectStore uses weak references to hold references to unmodified persistent objects. If your program does not have any references to a persistent object and the reference in the Object Table is the only reference, the object can be garbage collected. If the persistent object has been modified and the changes have not yet been saved, ObjectStore uses a strong reference to the reference to the object. A strong reference prevents the object from being garbage collected.
The COM.odi.migrateUnexportedStrings property controls what happens when ObjectStore encounters a cross-segment reference to an unexported String object. If this property is not set or if it is set to true, ObjectStore creates a new String object that has the same value as the referenced object. ObjectStore places this new string in the same segment as the referring object and substitutes this new string for the referenced string. If this property is set to false, ObjectStore throws ObjectNotExportedException if it encounters a reference to a string in another segment and that string is not exported.
COM.odi.ObjectStoreLibrary specifies the name of the native library that contains the ObjectStore schema and native methods for the application. The name should follow platform conventions for library names. If you do not specify this property, ObjectStore uses the standard library, which provides for primary Java objects but not Java peer objects.
COM.odi.user and COM.odi.password allow you to supply a user name and a password when the ObjectStore Server has Name Password set for the Authentication Required Server parameter.
COM.odi.product allows you to specify which Object Design Java product you want to use. The advantage of COM.odi.product is that it allows you to write an application that copies data among PSE, PSE Pro, and ObjectStore databases. You can set this property to one of the following three values: PSE, PSEPro, or ObjectStore. To use any of these products, you must have the software in your CLASSPATH environment variable. When this property is not set, Object Design software looks for PSE Pro, then PSE, then ObjectStore, and uses the first product it finds.
The setting of COM.odi.product applies only to the session for which it is specified. After you start a session, you cannot change the value of COM.odi.product. An example of how to use this property is in the user guide.
COM.odi.queryDebugLevel allows you to control debugging output when you are using the PSE Pro query facility defined in the COM.odi.util.query.Query class. In PSE, this property does nothing.
The default level is 0, which does not output any information. Set the property to a value greater than 0 to print debugging output to System.err. As the value of this property increases, the query facility outputs more information as follows:
In PSE, this property does nothing.
COM.odi.stringPoolSize specifies the maximum size of the persistent string pool. The value of this property specifies the maximum number of newly created strings that ObjectStore can maintain in the string pool. If the number of newly created strings exceeds this number, only the ones that were most recently created and used are tracked by the pool. The default value is 100. value is 100. Before ObjectStore migrates a string into a segment, it checks the pool to see if a string with the same value is already available in the segment. If it is, the string is reused and ObjectStore does not create a new one. ObjectStore clears the pool at the start of each transaction. You can turn off the pooling mechanism by setting the value of this property to 0.
The COM.odi.trapUnregisteredType property is useful for troubleshooting ClassCastExceptions. The default is that this property is not set, and it is usually best to use the default.
When ObjectStore encounters a type for which it does not have information, it checks the setting of the COM.odi.trapUnregisteredType property.
If the property is not set, ObjectStore creates an instance of the UnregisteredType class to represent the unknown type. Your application continues to run as long as it does not try to use the UnregisteredType object. Often, this can be fine because your application has no need for that particular field. However, if you do try to use the unregistered type, ObjectStore throws ClassCastException.
If COM.odi.trapUnregisteredType is set, ObjectStore throws FatalApplicationException and provides a message that indicates the name of the unregistered class. See the user guide for additional information.
public void terminate()
public void join()
public static void leave()
public abstract Transaction currentTransaction()
public abstract boolean inTransaction()
public static Session getGlobal()
public final boolean isActive()
public static Enumeration activeSessions()
public abstract Segment segmentOfpreFlushContentsObject()
public static Session getCurrent()
public static Session ofThread(Thread thread)
public final String getName()
public static Session of(Object object)
public abstract Properties getCounters(boolean reset)