0

Before start work on implementation Model layout, I ask few question on this site:

Correct design for entity classes. Need recommendations

Java Generics. What benefit in my case?

and

Two classes with almost duplicate code inside

Users give me many good and perfect recommendations.

In result, I create next implementation for my Model Layout: enter image description here

Can you please look on my screenshot. And tell me,

I correct understang all? And my implementation success?

P.S. link on lange image: http://www.dropmocks.com/mBf62w

Community
  • 1
  • 1
user471011
  • 7,104
  • 17
  • 69
  • 97

2 Answers2

1

Your solution lacks of one more thing, which is Service Layer. This is important, since you will use DAOs within the service layer to perform some business logic. Usually Database Transactions are also defined on the service layer, so keep that in mind.

I would also get rid of Persistent interface, since I don't see how it helps in anything, and instead - I would use abstract class for PersistentImpl. AbstractEntity would be more appropriate name then.

Other than that - your solution is neat and clean - I'm using it across several project of mine and I'm very happy with it :)

ŁukaszBachman
  • 33,595
  • 11
  • 64
  • 74
0

I don't bother with a dao when I use hibernate, seems unnecessary/superfluous and just have entities and a service layer (and a controller and view).

There are however differing views on this.

Community
  • 1
  • 1
NimChimpsky
  • 46,453
  • 60
  • 198
  • 311