SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Mark Spritzler wrote:
Can you remote debug and check line 9 where you call blogDao.getBlog(blogId) and stop past the line and examine the blog object in your debugger.
Mark Spritzler wrote:
Also can you post your code that is in the getBlog() method so that we can see your query you are running, but only if you find after you remote debug that the blog object returned doesn't have the correct data.
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Kengkaj Sathianpantarit wrote:Regarding architecture, actually DAO is a kind of service, it's data access service.
Even using DAO, the implementation can be anything including Web Services, RMI, etc., because we use interface, not concrete class.
But I don't like DAO pattern, I prefer to use Repository (Domain-Driven Design).
Jay Chmiel wrote:
Mark Spritzler wrote:
Can you remote debug and check line 9 where you call blogDao.getBlog(blogId) and stop past the line and examine the blog object in your debugger.
Well there is the System.out statement i used for debug. Its line 12:
It shows that size of collection is 1, so there is something wrong with it already.
Mark Spritzler wrote:
Also can you post your code that is in the getBlog() method so that we can see your query you are running, but only if you find after you remote debug that the blog object returned doesn't have the correct data.
Any ideas?
Mark Spritzler wrote:
Kengkaj Sathianpantarit wrote:Regarding architecture, actually DAO is a kind of service, it's data access service.
Even using DAO, the implementation can be anything including Web Services, RMI, etc., because we use interface, not concrete class.
But I don't like DAO pattern, I prefer to use Repository (Domain-Driven Design).
Sorry. a DAO/Repository is a Data Access Object, not a Use Case Service class. Service or business logic can use DAOs, but a DAO can never be considered business logic, if you try to merge the meaning of DAO with Service then you are just getting into low cohesion of your code and in OO and architecture that is not a good thing to do. And DAO and Repository is the same type of class. And yes I prefer the term Repository now too.
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Kengkaj Sathianpantarit wrote:
BlogDao should save blog, not save post.
It should be like this:
Kengkaj Sathianpantarit wrote:
Are you sure you have data in database?
Can you also post your mapping file?