Junilu Lacar wrote:I'll just point you in a direction for now, then you can come back with specific questions later. Search for loading a complex object graph. Pay attention to the ones that have references to Hibernate and JPA.
Juan Chris wrote:... and I feel that this is a bad practice.
Carey Brown wrote:With one-to-many you could add a relationship table with a column for channel ID and another column for program ID.
Liutauras Vilda wrote:Of course this case doesn't demonstrate such risk very well as 'id' would be 0 anyway, but I think you understand what I mean.
Dave Tolls wrote:In this case the id should be null.
The constructor with no id represents an object that hasn't been persisted to the database and so has no id yet.
You'll see it left alone in most models for this reason, since setting it to null is a bit pointless.
Juan Chris wrote:Inside the Service is where I should be calling more than one DAOs to get information from different places, I believe that makes sense.
Junilu Lacar wrote:
Juan Chris wrote:Inside the Service is where I should be calling more than one DAOs to get information from different places, I believe that makes sense.
That's the extra layer I was telling you about. Architecturally, it would look more like Model <--> Service <--> DAO <--> Persistent Store (DB, etc.)
Juan Chris wrote:First, what do you mean by this "<-->"?
Carey Brown wrote:
Juan Chris wrote:First, what do you mean by this "<-->"?
Bi-directional communication.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |