What are the license conditions of using TJDO?
TJDO is an open source project that is licensed under the Apache Software License. It is free to use and distribute.
We strongly encourage users to log bugs and feature requests, and contribute source code.
Why do I get the following exception?
javax.jdo.JDODataStoreException: Error adding constraints for table FOO NestedExceptions: java.sql.SQLException: ORA-00054: resource busy and acquire with NOWAIT specified
This is due to a transactional concurrency issue in Oracle that can occur when tables are auto-created on the fly. A call is made that results in a need to access one or more tables that don't exist. Since auto-create mode was enabled, TJDO attempted to dynamically create them, including any foreign key references, in a separate transaction. Under certain conditions (we're not sure what they are, perhaps if a row is locked, etc.), Oracle will generate the above exception when attempting to create a foreign key reference to a table that is "in-use".
This problem can only be avoided by pre-creating all of your database tables prior to using TJDO for object persistence. This can be done using the SchemaManager interface or by any other out-of-band mechanism that creates all of the necessary tables.
Why do I get a java.lang.IncompatibleClassChangeError
?
This exception can occur if one of the fields in the class where the error was thrown is declared in the Java code as static, but defined in the metadata as persistent. Static fields cannot be persistent. Check that your field definitions match their corresponding metadata attributes.
Why do the unit tests fail when I run them against PostgreSQL on windows? I keep seeing this exception:
javax.jdo.JDODataStoreException: Fetch request failed: SELECT date_widget.date_field,date_widget.sql_date_field, date_widget.sql_timestamp_field FROM date_widget WHERE (date_widget.date_widget_id = ?) NestedThrowables: The connection attempt failed because Exception: java.net.BindException: Address in use: connect Stack Trace: java.net.BindException: Address in use: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:350) ...
This exception can occur because of the Windows NT/2000/XP default configuration. The TCP/IP layer has a default maximum of 1000 connections allowed in the TIMED_WAIT state. To remedy this, modify or create the following registry key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\TcpTimedWaitDelay
This is a DWORD with valid values between 30 and 300 (default is 240). This key specifies the length of time (in seconds) that a connection will stay in the TIMED_WAIT state before it is closed. By using a low number, you effectively increase the maximum connection limit. Note: you may have to restart Windows for this setting to take effect.
I get the following exception during class enhancement:
java.lang.IllegalArgumentException: The class name "[Foo]" is invalid, or has not been compiled.
In this case, the class Foo had already been enhanced but was referenced in the "persistence-capable-superclass" metadata attribute of another class as simply "Foo", instead of as Foo's fully-qualified class name. This attribute must always be a fully-qualified class name (see section 18.3 of the JDO spec).
Second class object factories are not behaving to spec.
When a Collection or Set is specified as the type argument when
invoking PersistenceManager.newSCOInstance(Class type, Object owner,
String fieldName)
, the object returned does not allow nulls
to be added as elements.
Similarly, the allowNulls
argument on the
newCollectionInstance
method is ignored when the type is
a Collection or Set.
Nulls in Sets are not currently supported by TJDO. We don't expect this to be a needed feature (a Set by definition could only contain at most one null).
How do I delete JDO-created database tables?
A utility class exists for this in tjdo.jar. The class com.triactive.jdo.DropJDOTables has a main() method that will drop all of the tables and constraints defined in the JDO_TABLE table.
The database and schema that the utility runs against are defined by the system properties:
database.driver (e.g. "oracle.jdbc.OracleDriver") database.url (e.g. "jdbc:oracle:thin:@tnm1_oracle1:1521:ora1") database.user database.password
When is jdoPreStore() called?
The JDO spec states the following in chapter 10, "InstanceCallbacks":
public void jdoPreStore()
This method is called before the values are stored from the instance to the data store. This happens during beforeCompletion for persistent-new and persistent-dirty instances of persistence-capable classes that implement
InstanceCallbacks
. Data store fields that might have been affected by modified non-persistent fields should be updated in this method. This method is modified by the enhancer so that changes to persistent fields will be reflected in the data store.
The first sentence is the key; the jdoPreStore() call occurs whenever values are stored to the data store, not when the changes are committed in the data store (although the two often coincide). Since it is up to the JDO implementation to decide when values of a persistent-dirty object are sent to the data store, jdoPreStore() may conceivably be called at any point during a transaction. In fact, it may be called multiple times if the JDO runtime decides, for cache consistency, that a dirty object should be flushed.
In general, there's no way to reliably predict when a jdoPreStore() call will occur. Conceptually however, code can assume that whenever the call is made a database INSERT or UPDATE for that object is about to be performed.
What is the state of an object retrieved from a query; hollow or persistent-clean?
The JDO spec allows either and leaves the choice to the implementation. In TJDO, query result objects are always persistent-clean, with all fields of the default fetch group loaded, unless the object was already instantiated by that PM, in which case the in-memory instance is used as-is.
Can you use either single our double quotes as String delimiters in query filters?
No. As in Java, single quotes are used to delimit character literals, and double quotes are used to delimit string literals.