title: While passing an enum in a REST controller, I'm getting java.lang.IllegalArgumentException whereas I'm using enum as string
body: <p>Controller:-</p>
  
  <pre><code>@RequestMapping(value="/CreateMovie", method= RequestMethod.POST)
      public HttpStatus createMovie(@RequestBody JSONObject object) {
          Movie movie =new Movie(object.optString("name"),
                      MovieType.valueOf(object.optString("type")),
                      new Date(object.optString("releasedate")),
                      Integer.parseInt(object.optString("time")), 
                      Genre.valueOf(object.optString("genre")));
              //object.
  
      repository.save(movie);
  
      return HttpStatus.OK;
  
  }
  </code></pre>
  
  <p>Entity is as follows:-</p>
  
  <pre><code>@Entity(name="Movie")
  public class Movie {
  
  
      public Movie()
      {
  
      }
      public Movie(String name,MovieType type,Date releasedate,
            int movie_length, Genre genre)
      {
          this.name=name;
          this.type=type;
          this.releasedate=releasedate;
          this.movie_length=movie_length;
          this.genre=genre;
      }
  
      @Id
      @GeneratedValue(strategy= GenerationType.IDENTITY)
      @Column(name="Id")
      private long id;
  
      @Column(name="movie_name")
      @NotNull
      String name;
      @Enumerated(EnumType.STRING)
      //@NotNull
      MovieType type;
      @Column(name="release_date")
      @JsonFormat(shape=STRING, pattern="dd-MM-yyyy")
      //@NotNull
      Date releasedate;
      @Column(name="movie_length")
      //@NotNull
      int movie_length;
      @Column(name="like_percentage")
      float likepercentage;
      @Column(name="no_of_reactions")
      float no_of_reactions;
      @Column(name="avg_rating")
      float avg_rating;
      @Column(name="no_of_reviews")
      int no_of_reviews;
      @Column(name="director")
      @NotNull
      String director;
      @Transient
      List&lt;String&gt; cities;
      @Transient
      List&lt;String&gt; cast;
  </code></pre>
  
  <p>Enum is as follows:-</p>
  
  <pre><code>public enum MovieType {
  
      Hindi("Hindi"),
      English("English"),
      Telugu("Telugu"),
      Malyalam("Malyalam"),
      Kannada("Kannnada");
  
      private String name;
  
      public String getName() {
          return name;
      }
  
      MovieType(String name) {
          this.name = name;
      }
  
  
  }
  </code></pre>
  
  <p>Stack Trace is as below:-</p>
  
  <p>Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: No enum constant com.example.Model.MovieType.] with root cause</p>