Custom Entity with a uid property We seem to be experiencing a very unexpected problem.

We have created a custom entity called feature and it has a uid property. The schema is as follows:

$schema['feature'] = array(
  'fields' =&gt; array(
    'fid' =&gt; array(
      'description' =&gt; 'feature id',
      'type' =&gt; 'serial',
      'not null' =&gt; TRUE,
    ),
    'bundle' =&gt; array(
      'description' =&gt; 'bundle name',
      'type' =&gt; 'varchar',
      'length' =&gt; 32,
      'not null' =&gt; TRUE,
    ),
    'nid' =&gt; array(
      'description' =&gt; 'Node ID.',
      'type' =&gt; 'int',
      'not null' =&gt; TRUE,
    ),
    'tid' =&gt; array(
      'description' =&gt; 'Taxonomy Term ID.',
      'type' =&gt; 'int',
      'not null' =&gt; TRUE,
    ),
    'uid' =&gt; array(
      'description' =&gt; 'User ID.',
      'type' =&gt; 'int',
      'not null' =&gt; TRUE,
    ),
    'created' =&gt; array(
      'description' =&gt; 'created timestamp',
      'type' =&gt; 'int',
      'not null' =&gt; TRUE,
    )
  ),
  'unique keys' =&gt; array(
    'primary key' =&gt; array('fid'),
    'nid-tid-uid' =&gt; array('nid', 'tid'),
  )
);


An entity is then picked up with 

$query = new EntityFieldQuery();
$query-&gt;entityCondition('entity_type', 'feature')
  -&gt;entityCondition('bundle', 'disabled')
  -&gt;propertyCondition('tid', $tid)
  -&gt;propertyCondition('nid', $nid)
  -&gt;addMetaData('account', user_load(1));
$result = $query-&gt;execute();

if (isset($result['feature'])) {
  $features = entity_load('feature', array(reset($result['feature'])-&gt;fid));
  $feature =  reset($features); // $feature here as the wrong uid
}


However, no matter what permutation I try, the uid is always set to 1.

The database has the correct information - so the data is being stored correctly.

The entity has views integration and pulling the data in through views works correctly as well.

Outputting the $feature always gives a uid = 1.

I even have traced through the EntityAPIController with little luck.

I tried loading an unrelated entity (Field Collection Item). This entity does not have a uid field. However, after entity_load it seems that a uid property is set.

Does this mean that having a uid property on an entity is just not possible? There does not seem to be any documentation to suggest that this is the case though.

I know that I can just rename it to aid or something else but am curious as to the cause here.

Thanks...
I left it overnight, and by the following day, the issue was gone.... :-/