Please advise that what is DTO pattern as I came from my analysis is that it is data transfer object pattern , Can you please advise any example of it in Hibernate specially or in any other java example, Thanks
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A DTO is one of the work-arounds for the terrible persistence found in EJB 2.1 (collectively known as the Sun Blueprint Catalog). It is used for extracting data from a entity bean and passing it to the data layer. Data from that layer is placed in a DTO and put into the entity bean. This is only for bean managed persistence.
This is what was officially the meaning of a DTO. Today you also find this in transferring data from the back-end to the front-end (in client-server architecture).
If you want to use this in Hibernate, create a query/criteria for selecting the columns you need and then use the
AliasToBeanResultTransformerfor setting these columns in a DTO. An example in the Hibernate documentation: