lundi 4 septembre 2017

Java Http CRUD Methods

sorry about the new topic. In University a few semesters ago I had to build a CRUD for a Java Application, that was my backend language at the time, in that situation I wrote a method for every CRUD that a column in my database required and repeated the process for every single column in the table and the same about their combination (the tables weren't a big deal, It took some time and work but we dit It), e.g: Suppose a Table in a database with the columns Name, Last Name, Birth Date and Social Security Number. I had built this code back then:

@Path("/Person"){

        @Path("/getName/login={login}
        @GET
        @Produces(MediaType.APPLICATION_JSON)
        public getNameByLogin(@PathParam("login") String login){
          ...
         }
        @Path("/getBirthDate/name={name}
        @GET
        @Produces(MediaType.APPLICATION_JSON)
        public getBirthDateByname(@PathParam("name") String name){
          ...
         }
        @Path("/getSoSeNum/name={name}&birthDate={birth}
        @GET
        @Produces(MediaType.APPLICATION_JSON)
        public getBirthDateByname(@PathParam("name") String name, @PathParam("birth") String birth){
          ...
         }
...

} 

As you can see, even for a simple DataBase it will be a Tiring and long workflow. Now I have the task to do something like that in my job with a far more complex DataBase and I want to find out other methods to do this kind of things, my basic problem is to provide for the User of my application a variety of filters in search fields ou just flexibility to fetch data. I'm sorry if the topic is repeated, If someone thinks this is too easy I accept some guidance about some studying fonts to guide me through this. Thank you all eversince.




Aucun commentaire:

Enregistrer un commentaire