Hi. I have a model layer written with hibernate, and I have for example entities
Code:
public class ClassA{
Integer id;
String name;
ClassB reference; //lazily fetched
}
public class ClassB{
Integer id;
String someString;
}
and I want to have a web tier independet to the business code, so I don't open a session for the request to avoid hibernate code there. Instead, I open the session in each method in the model layer.
Now, i want to render table in the web tier with atributes ClassA.name, ClassB.someString. I'd like to ask what is the best practics to do this. Should I have a data trasfer object for each such table with the attributes of several entities?
The example with two classes I wrote is pretty simple, but I can have many classes or collections lazily fetched this way.
I hope i didn't describe the problem too confusedly to understand..