Should an Entity ever know anything about its DAO?
I have a chance to introduce NHibernate to my group by using it with some new components that are being added to a legacy application.  I'm trying to get my head around using the DAO pattern with NHibernate, and am stumped with an architectural question.

In my _fictional_ example, let's say I have CarDAO and a Car entity:

    public interface CarDAO {
        Car FindById(int id)
        ... // everything else
    }

    public interface Car {
        ... various properties and methods
    }

I have a need to be able to convert a car to right-hand drive. Since this would be a very complex operation, I need to execute a stored procedure.  I'm not clear on where the ConvertToRightHandDrive() method should go.

It makes sense to me to put the method on Car, and let it call a method on the CarDAO that will execute the stored procedure.  And this is where I'm not clear:

- should Car have a reference to the CarDAO and call CarDAO.ConvertToRightHandDrive?
- should there be some sort of CarService layer that calls CarDAO.ConvertToRightHandDrive?
- what about injecting the CarDAO through the method on Car (Car.ConvertToRightHandDrive(carDAO))
- some other option?

Perhaps this is only a religious argument, and people have differing opinions on whether or not an Entity should have a reference to its DAO (or any other DAO, for that matter). I've been searching StackOverflow for some time, and have seen several discussions around this topic; but, I'd be interested in people's opinions in this particular scenario.


Should an Entity ever know anything about its DAO?
===

I have a chance to introduce NHibernate to my group by using it with some new components that are being added to a legacy application.  I'm trying to get my head around using the DAO pattern with NHibernate, and am stumped with an architectural question.

In my _fictional_ example, let's say I have CarDAO and a Car entity:

    public interface CarDAO {
        Car FindById(int id)
        ... // everything else
    }

    public interface Car {
        ... various properties and methods
    }

I have a need to be able to convert a car to right-hand drive. Since this would be a very complex operation, I need to execute a stored procedure.  I'm not clear on where the ConvertToRightHandDrive() method should go.

It makes sense to me to put the method on Car, and let it call a method on the CarDAO that will execute the stored procedure.  And this is where I'm not clear:

- should Car have a reference to the CarDAO and call CarDAO.ConvertToRightHandDrive?
- should there be some sort of CarService layer that calls CarDAO.ConvertToRightHandDrive?
- what about injecting the CarDAO through the method on Car (Car.ConvertToRightHandDrive(carDAO))
- some other option?

Perhaps this is only a religious argument, and people have differing opinions on whether or not an Entity should have a reference to its DAO (or any other DAO, for that matter). I've been searching StackOverflow for some time, and have seen several discussions around this topic; but, I'd be interested in people's opinions in this particular scenario.

