How to add relationship in view for custom entity I have an entity that references node and user via nid and uid fields.

I have created an entity around my schema and would like to use it in views. I can create a view based on a new entity that shows fields from the entity. 

Now I want to add relationships to node and user so I could pull fields from them. So I want to show fields from related user and node, not my entity bundles.

What's the right way to do this?
Entity API supports this out of the box, but you will have to let it know which entity your data represents. If Entity API encounters a field containing numeric data it will by default assign it the type 'integer'. Just change the type to the right entity type and you can define the relations in Views:

&lt;?php
  /**
   * Implements hook_entity_property_info_alter().
   */
  function my_entity_entity_property_info_alter(&amp;$info) {
    $info['my_entity']['properties']['nid']['type'] = 'node';
    $info['my_entity']['properties']['uid']['type'] = 'user';
    $info['my_entity']['properties']['tid']['type'] = 'taxonomy_term';
  }
?&gt;