Hi all,
I'm trying to make a class which acts like an aggregate of persistent entities. However, I do not want this class persisted.
As an example, I'd like to have a nonpersistent class House that is made up of persistent classes Windows, Doors, and Walls. I'd like to be able to call HouseDAO.save(house) and have it save all my doors, walls, and windows.
My mental pseudo-code:
class House {
@Table(name="Door")
private Door frontDoor;
private Door backDoor;
@Table (name="wall")
private Wall wall1;
@Table (name="Window")
private Window boxWindow;
... getters and setters for each
}
But that obviously doesn't work. Should I even persue this or should I just make a HouseDAO which handles everything individually? Or create a House service to farm out to the wall, window and door DAOs? Is there a standard way of doing this? I looked at both the Repository and Aggregate Entity patterns, but they don't really seem to fit.
Any suggestions or pointers would be great.
Thanks,
Mike
|