title: Cross referencing an Entity from another ear
body: <p>What I basically have is this (obfuscated example of my real domain code):</p>
  
  <h2>In CarDaoEar:</h2>
  
  <pre><code>@Entity
  public class Car {
  //...
  }
  
  @Stateless
  public class CarDao implements CarDaoRemote {
     @PersistenceContext( unitName = "carPersistenceUnit" )
     private EntityManger em;
  
     public void storeCar( Car car ) {
        em.persist( car );
     }
  
     public Car findCar( Car car ) {
       return em.find( Car.class, car.getID );
     }
  }
  
  @Remote
  public interface CarDaoRemote {
     public void storeCar( Car car );
  
     public Car findCar( Car car );
  }
  </code></pre>
  
  <h2>In CarInventoryTimerEar:</h2>
  
  <pre><code>@Stateless
  public class CarInventoryTimer {
  
     @EJB
     private CarDaoRemote _carDaoRemote;
  
     // do some stuff with _carDaoRemote...
  
  }
  </code></pre>
  
  <p>So the problem is, if I package the Entity &amp; dao bean with CarInventoryTimerEar then the app server complains that I am trying to deploy the Entity again - I understand this. If, however, I don't include the classes I get a ClassNotFoundException - this also makes sense. </p>
  
  <p>I am sure I am not the first one to do something similar to this - so to all you EJB experts out there, what am I doing wrong? How do I make this work?</p>
  
  <p>TIA</p>