er.extensions.eof
Class ERXLongPrimaryKeyFactory
java.lang.Object
er.extensions.eof.ERXLongPrimaryKeyFactory
public class ERXLongPrimaryKeyFactory
- extends Object
- Author:
- david@cluster9.com
Automatically generates Long primary
keys for entities. Features a cache which reduces database roundtrips
as well as optionally encoding Entity type in PK value.
usage:
override either the ERXGeneratesPrimaryKey
interface like this:
private NSDictionary _primaryKeyDictionary = null;
public NSDictionary primaryKeyDictionary(boolean inTransaction) {
if (_primaryKeyDictionary == null) {
_primaryKeyDictionary = ERXLongPrimaryKeyFactory.primaryKeyDictionary(this);
}
return _primaryKeyDictionary;
}
or manually call
ERXLongPrimaryKeyFactory.primaryKeyDictionary(EOEnterpriseObject eo);
the necessary database table is generated on the fly.
Encoding Entity in PK values
If the system
property
ERXIntegerPrimaryKeyFactory.encodeEntityInPkValue is
set to true then the last 6 bits from the 64 bit
primary key is used to encode the Subentity in the pk value. This
speeds up inheritance with multiple tables. In order to support this
you must add an entry to the userInfo from the Subentities:
key=entityCode
value= %lt;%lt; an unique integer, no longer than 6 bit - 1
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ERXLongPrimaryKeyFactory
public ERXLongPrimaryKeyFactory()
subEntityForEntity
public EOEntity subEntityForEntity(EOEntity entity,
NSDictionary pkDict)
primaryKeyValue
public static Object primaryKeyValue(String entityName)
primaryKeyDictionary
public static NSDictionary primaryKeyDictionary(EOEnterpriseObject eo)
Copyright © 2002 – 2007 Project Wonder.