Hi guys! I'm new to Java and I'm now studying Spring + Hibernate. In the samples I found on the web there were business objects with methods like:
The UserDao class is a bean injected from Spring and would make the call to hiberate and stuff.
But that's not rights is it? I mean, this is coupling the data access layer with your business model. From what I can remember the business model should not know about about dao's. Or is it? It's true I can think of some situations where injecting the dao in the business class would come in handy but that's just because i don't know more about hibernate.
Thanks in advance and sorry if my question is silly
well the point was that you usually have one dao and many domain object. you can't inject them all in the dao. you don't even know when they'll get instantiated
posted 8 years ago
actually i might be mistaken. one layer should be allowed to know only about the layer directly below and dao is directly under domain layer. so it actually could be correct. i just got confused because i saw different implementations of the same sample problem in many different ways.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads