M
M
MrD2013-06-17 20:41:28
Java
MrD, 2013-06-17 20:41:28

JPQL select from 2 tables and output to jsp page?

When developing a project in java, ee encountered such a problem. No where can I find an example of how to work with data when selecting from 2 entities. The problem is this. In essence, a request is described for selecting some fields from table one and table two, then in the EJB Session Bean (DAO) I describe a method with a call to this request by name and return the result, I call it in the servlet and pass the result through it to the jsp page.
When working with a single entity, there were no such problems, although this was due to the overriding of the toString method in the entities. Those selection itself occurs, but it is not possible to correctly display the result on the page (as with a selection from one entity), since there are links to objects. The result of the request can be parsed, what I do when checking the request, but I don’t think that I’m going the right way, I think there is a more correct way.
PS I use Eclipse, without any additional frameworks connected by me. I display on the page using jstl tags.
PS2 I don't specifically attach my code because I want to find the right solution to the problem with already established approaches, possibly described as a standard (those through annotations or some other mechanisms), if there is one.
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question