In my previous REST Webservice tutorial i explained how to write your first REST Webservice and the other tutorial was about using the Hibernate APIs.
In this example, we shall write the webservice which would perform the database operations using Hibernate APIs.
The example we need a table in database as
CREATE TABLE TESTPLAYERRESTWS
( "ID" NUMBER NOT NULL ENABLE,
"NAME" VARCHAR2(50 BYTE),
"SPORTS" VARCHAR2(50 BYTE)
)
Please download the sample code from here.
For this example we have created 4 methods:
get all player -- > /player
get player by id --> /player/{playerid}
update player -- > /updatePlayer
create player -- > /createPlayer
I have created a tester file along with the application which can be used to test the REST Webservice and its DB operations.
The example is self explanatory. Please feel free to contact in case of any questions
In this example, we shall write the webservice which would perform the database operations using Hibernate APIs.
The example we need a table in database as
CREATE TABLE TESTPLAYERRESTWS
( "ID" NUMBER NOT NULL ENABLE,
"NAME" VARCHAR2(50 BYTE),
"SPORTS" VARCHAR2(50 BYTE)
)
Please download the sample code from here.
For this example we have created 4 methods:
get all player -- > /player
get player by id --> /player/{playerid}
update player -- > /updatePlayer
create player -- > /createPlayer
I have created a tester file along with the application which can be used to test the REST Webservice and its DB operations.
The example is self explanatory. Please feel free to contact in case of any questions
No comments:
Post a Comment