Skip to main content
1-Visitor
May 16, 2014
Question

Find global attribute definition id

  • May 16, 2014
  • 0 replies
  • 1057 views

Hi.

How to find global attribute definition id by logical identifier?

I'm trying to use next code:

/* attributeId is Logical Identifier of my global attribute */

long IBABooleanDefinitionId = 0;

BooleanDefinition booleanDefinition;

QuerySpec querySpec = new QuerySpec(BooleanDefinition.class);

CompositeWhereExpression whereExpression = new CompositeWhereExpression(LogicalOperator.AND);

whereExpression.append(new SearchCondition(BooleanDefinition.class, WTTypeDefinition.LOGICAL_IDENTIFIER, SearchCondition.EQUAL, attributeId), new int[]{0});

querySpec.appendWhere(whereExpression, new int[]{0});

QueryResult queryResult = PersistenceHelper.manager.find((StatementSpec) querySpec);

if(queryResult.hasMoreElements())

{

booleanDefinition = (BooleanDefinition) queryResult.nextElement();

IBABooleanDefinitionId = booleanDefinition.getPersistInfo().getObjectIdentifier().getId();

}

I have wt.query.QueryException that "logicalIdentifier" does not belongs to class wt.iba.definition.BooleanDefinition

Ok, but i cannot find field "logicalIdentifier" in BooleanDefinition though Logical Identifier textfield exists in global attribute creation form.

How should i fix my code?

Thanks.