I am new to web services. Please give suggestions how to insert and retrieve data from database using jersey JAX – RS in java?
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.
Below is an example of a JAX-RS service implemented as a session bean using JPA for persistence and JAXB for messaging might look like.
CustomerService
Customer
Below is an example of one of the entities. It contains both JPA and JAXB annotations.
For More Information
UPDATE
You can deploy a JAX-RS/EJB/JPA/JAXB application to any Java EE 6 compliant application server without requiring any additional server set up. Programming the client you can get the JAX-RS APIs from the Jersey (http://jersey.java.net/), and the JPA and JAXB APIs from EclipseLink (http://www.eclipse.org/eclipselink/).
JDBC Resource & Connection Pool
You need to configure a connection pool on your application server. Below are the steps to do this on GlassFish. The steps will vary depending on the application server you are using.
JPA Configuration
Then we reference the database connection we created above in the
persistence.xmlfile for our JPA entities as follows: