NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
nbisalehalli
Joined: 29 Sep 2009 Posts: 2
|
Posted: Tue Sep 29, 2009 2:26 pm Post subject: RESTful web services with mysql problem |
|
|
| Could anyone please tell me how to use RESTful Web services to query more than one table in mysql? All examples I find use only one table to demonstrate the concept of exposing the database as a web service. How do we perform JOINS on multiple mysql tables in RESTful Web services? |
|
| Back to top |
|
 |
Jeff Rubinoff Posted via mailing list.
|
Posted: Tue Sep 29, 2009 10:56 pm Post subject: RESTful web services with mysql problem |
|
|
Could anyone who answers this please cc me?
Jeff
nbisalehalli wrote:
| Quote: | Could anyone please tell me how to use RESTful Web services to query more than one table in mysql? All examples I find use only one table to demonstrate the concept of exposing the database as a web service. How do we perform JOINS on multiple mysql tables in RESTful Web services?
|
|
|
| Back to top |
|
 |
Arshad Noor Posted via mailing list.
|
Posted: Tue Sep 29, 2009 11:33 pm Post subject: RESTful web services with mysql problem |
|
|
One way to solve this problem is to create a Session EJB that
interposes itself between the web-service and the database.
There are multiple advantages with this model:
1) You have significantly more flexibility with JPQL
statements in the EJB, and can join as many tables as you
wish, while returning exactly what you process in the EJB
through the web-service;
2) You create a level of indirection to the database that
shields your web-service consumers from schema changes in
the database;
3) This same indirection gives you new-found flexibility to
add new business-logic into the EJB without necessarily
having to change your web-service (if business rules don't
require it);
4) You can scale much better by managing the number of EJBs
than by trying to manage the number of listeners for the
web-service;
5) Most importantly, a major security vulnerability - SQL
Injection attacks - is rendered useless because the EJB
can be written to reject SQL/JPQL statements in input
parameters (since it will have its own JPQL named-queries
that do the actual work with the database).
There may be other reasons that I cannot think of on the spur
of the moment, but I would strongly recommend using a Session
EJB to support the web-service. With JEE5 and NB 6.x, this
model is so much easier to build and deploy (than J2EE 1.4).
Arshad Noor
StrongAuth, Inc.
| Quote: | nbisalehalli wrote:
| Quote: | Could anyone please tell me how to use RESTful Web services to query
more than one table in mysql? All examples I find use only one table
to demonstrate the concept of exposing the database as a web service.
How do we perform JOINS on multiple mysql tables in RESTful Web services? |
|
|
|
| Back to top |
|
 |
nbisalehalli
Joined: 29 Sep 2009 Posts: 2
|
Posted: Wed Sep 30, 2009 5:54 pm Post subject: |
|
|
| Thank you much for your reply Arshad. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|