public ListlistEntitySummaries() {
String query
= "select new com.myapp.model.dto.MyEntitySummaryDTO(e.id, e.title) from MyEntity e";
return (List) em.createQuery(query).getResultList();
}
The DTO in this case was a very simple java bean. I didn't need to declare it in persistence.xml. I did have to use the fully qualified classname however otherwise Toplink (in my case) couldn't find the constructor.
1 comment:
Post a Comment