DAO interface in Java EE architetcure
I'm implementing a Java EE project, and in my a part of my class diagram i have a association class which link two classes samples( in french Echantillon) and analysis( in french AnalyseElementaire)( N.B: the project is for a 开发者_如何学运维chemical laboratory, see the image below)
after i generated the database with the POWER AMC( POWER AMC is a Sybase product), and using hiberante tools inside eclipse in order to genrate the domain model classes, it generates two classes for Result: the first one is "Result" and the second is ResultId, the last one which manage Result id which is a composite id from the identifiers of the two classes samples and analysis: i would know if it's necessary to create a DAO class for ResultID.ResultID is, I guess, the class of the composite ID of the Result entity. It's not a hibernate Entity, just an ID. It's needed because the Result table has a composite primary key, composed of the ID of the AnalyseElementaire and the ID of the Echantillon.
There shouldn't be any DAO for the class, since it's not persistent.
It would certainly be easier to add a surrogate primary key in the Result table, to avoid the composite ID.
精彩评论