Examples of primaryKeyAttributes()


Examples of com.webobjects.eoaccess.EOEntity.primaryKeyAttributes()

    /**
     * Internal helper method for <code>insertSavedObject</code>.
     */
    protected EOGlobalID assignFakeGlobalIDToObject(final EOCustomObject anObject) {
        EOEntity entity = EOUtilities.entityNamed(this, anObject.entityName());
        NSArray primaryKeyAttributes = entity.primaryKeyAttributes();
        if (primaryKeyAttributes.count() != 1)
            throw new IllegalArgumentException(entity.name() + " has a compound primary key and can't be used with insertSavedObject().");
        NSDictionary primaryKeyDictionary = new NSDictionary(fakePrimaryKeyCounter++, ((EOAttribute)primaryKeyAttributes.objectAtIndex(0)).name());
        EOGlobalID globalID = entity.globalIDForRow(primaryKeyDictionary);
        anObject.__setGlobalID(globalID);
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.primaryKeyAttributes()

      NSMutableArray<EOSQLExpression> result = new NSMutableArray<EOSQLExpression>();

      for (int i = entityGroup.count() - 1; i >= 0; i--) {
        EOEntity eoentity = entityGroup.objectAtIndex(i);
        String externalName = eoentity.externalName();
        NSArray<EOAttribute> priKeyAttributes = eoentity.primaryKeyAttributes();

        if (priKeyAttributes.count() == 1 && externalName != null && externalName.length() > 0) {
          EOAttribute priKeyAttribute = priKeyAttributes.objectAtIndex(0);
         
          // pk counter not needed for non number primary key
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.primaryKeyAttributes()

   
    @Override
    protected long createRow(Connection con, long increment) throws SQLException {
      EOEntity entity = ERXEOAccessUtilities.rootEntityForEntityNamed(_entityName);
      String tableName = entity.externalName();
      String colName = entity.primaryKeyAttributes().lastObject().columnName();
      String sql = "select max(" + colName + ") from " + tableName;

      ResultSet resultSet;
      resultSet = con.createStatement().executeQuery(sql);
      con.commit();
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.primaryKeyAttributes()

            StringBuilder statement = new StringBuilder("ALTER TABLE ");
            statement.append(tableName);
            statement.append(" ADD CONSTRAINT ");
            statement.append(constraintName);
            statement.append(" PRIMARY KEY (");
            priKeyAttributes = entity.primaryKeyAttributes();
            priKeyAttributeCount = priKeyAttributes.count();
            for (j = 0; j < priKeyAttributeCount; j++) {
                priKeyAttribute = (EOAttribute) priKeyAttributes.objectAtIndex(j);
                String attributeName = result.sqlStringForAttribute(priKeyAttribute);
                statement.append(attributeName);
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.primaryKeyAttributes()

        NSMutableSet sequenceNames = new NSMutableSet();
        results = new NSMutableArray();
        count = entityGroup.count();
        for (i = 0; i < count; i++) {
            entity = (EOEntity) entityGroup.objectAtIndex(i);
            priKeyAttributes = entity.primaryKeyAttributes();
            if (priKeyAttributes.count() == 1) {
                priKeyAttribute = (EOAttribute) priKeyAttributes.objectAtIndex(0);
               
                // Q: Don't create a sequence for non number primary keys
                if (priKeyAttribute.adaptorValueType() != EOAttribute.AdaptorNumberType) {
View Full Code Here

Examples of com.webobjects.eoaccess.EOEntity.primaryKeyAttributes()

        if(gid instanceof EOKeyGlobalID) {
            // ak: when you use 24 byte PKs, the output is unreadable otherwise
            EOKeyGlobalID kgid = (EOKeyGlobalID)gid;
            gidString = "<" +  kgid.entityName() + ": [" ;
            EOEntity entity = ERXEOAccessUtilities.entityNamed(null, kgid.entityName());
            NSArray pks = entity.primaryKeyAttributes();
            NSArray values = kgid.keyValuesArray();
            EOSQLExpressionFactory expressionFactory = context.database().adaptor().expressionFactory();
            EOSQLExpression expression = null;
            if (expressionFactory != null) {
              expression = expressionFactory.expressionForEntity(entity);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.