What I basically have is this (obfuscated example of my real domain code):
In CarDaoEar:
@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 );
}
In CarInventoryTimerEar:
@Stateless
public class CarInventoryTimer {
@EJB
private CarDaoRemote _carDaoRemote;
// do some stuff with _carDaoRemote...
}
So the problem is, if I package the Entity & 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.
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?
TIA