title: $resource POST Error 400
body: <p>Hi guys i'm working with angular $resource to make POST call. This is my FE function</p>
  
  <pre><code>$scope.showPrompt = function (ev) {
          $scope.usernameSelected = [];
          $scope.users.forEach(function (element) {
              if (element.checked)
                  $scope.usernameSelected.push(element);
              console.log($scope.usernameSelected);
          });
          var conferma = $mdDialog.prompt()
                  .title('Insert group name?')
                  .clickOutsideToClose(true)
  
              //.textContent('Bowser is a common name.')
              .placeholder('Group name')
              .ariaLabel('Group name')
              .targetEvent(ev)
              .ok('Crea gruppo')
              .cancel('Annulla');
  
      $mdDialog.show(conferma).then(function (result) {
              GroupService.group({}, {
              creatore: $cookieStore.get('username'),
              gruppo: result,
              partecipanti: $scope.usernameSelected},
          function (data) {
              console.log("GRUPPO", data);
          });
          $scope.status = 'NOMEGRUPPO: ' + result + '.';        //inserito il nome gruppo
      }, function () {
  
          $scope.status = 'INSERT NOME GRUPPO';
      });
  };
  </code></pre>
  
  <p>This the GroupService:</p>
  
  <pre><code>var groupService = angular.module("groupService",['ngResource']);
  
  groupService.factory("GroupService",['$resource',
     function($resource){
           var url = "";
          return $resource("",{},{
                  group: {method : "POST", url:url+"group", isArray: false},
                  findGroup: {method : "GET", url:url+"findGroup", isArray: true}
          });    
  }]);
  </code></pre>
  
  <p>I have this error:</p>
  
  <pre><code>angular.js:14328 Possibly unhandled rejection: {"data":"&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/8.5.11 - Error report&lt;/title&gt;&lt;style type=\"text/css\"&gt;h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}&lt;/style&gt; &lt;/head&gt;&lt;body&gt;&lt;h1&gt;HTTP Status 400 - &lt;/h1&gt;&lt;div class=\"line\"&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Status report&lt;/p&gt;&lt;p&gt;&lt;b&gt;message&lt;/b&gt; &lt;u&gt;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;description&lt;/b&gt; &lt;u&gt;The request sent by the client was syntactically incorrect.&lt;/u&gt;&lt;/p&gt;&lt;hr class=\"line\"&gt;&lt;h3&gt;Apache Tomcat/8.5.11&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;","status":400,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"group","data":{"creatore":"ciro","gruppo":"nuovo","partecipanti":[{"id":0,"username":"a","email":"a@aa","password":null,"name":"a","surname":"a","longitude":0,"latitude":0,"checked":true},{"id":0,"username":"ciao","email":"ciao@ciao","password":null,"name":"ciao","surname":"ciao","longitude":0,"latitude":0,"checked":true}]},"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json;charset=utf-8"}},"statusText":""}
  </code></pre>
  
  <p>This is my BE code. I have a spring controller that manage client requests</p>
  
  <pre><code>@RequestMapping(value = "/group", method = RequestMethod.POST)
      public @ResponseBody
      Group createGroup(@RequestBody Group json, HttpServletRequest request) throws SQLException, ClassNotFoundException {
  
      Group g = DBUtils.insertGroup(json.getPartecipanti(), json.getGruppo(), json.getCreatore());
      return g;
  }
  </code></pre>
  
  <p>This is my DBUtils.insertGroup</p>
  
  <pre><code>public static Group insertGroup(List&lt;String&gt; members, String groupName, String userCreator) throws ClassNotFoundException, SQLException {
  
          Class.forName("com.mysql.jdbc.Driver");
          Connection conn;
  
          conn = DriverManager.getConnection(DB_URL, USER, PASS);
  
          String sql = "insert into gruppo \n"
                  + " (idCreatorUser,groupName,idPartecipante,data) values (?,?,?,?) ";
  
          PreparedStatement pstm = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
          java.util.Date date = new Date();
          Timestamp timestamp = new Timestamp(date.getTime());
  
          Utente creator = DBUtils.findUser(userCreator);
  
          pstm.setInt(1, creator.getId());
          pstm.setString(2, groupName);
          pstm.setInt(3, creator.getId());
          pstm.setTimestamp(4, timestamp);
          int res = pstm.executeUpdate();
          ResultSet rsId = pstm.getGeneratedKeys();
          rsId.next();
          int idGruppo = rsId.getInt(1);
  
          Group response = new Group();
          response.setIdGruppo(idGruppo);
          response.setGruppo(groupName);
          response.setIdCreatore(creator.getId());
          response.setData(timestamp);
          response.setPartecipanti(members);
          response.setCreatore(creator.getUsername());
          System.out.println(response);
  
          sql = "insert ignore into gruppo \n"
                  + " (idGruppo,idCreatorUser,groupName,idPartecipante,data) values (?,?,?,?,?) ";
          pstm = conn.prepareStatement(sql);
          Utente part;
          for (int i = 0; i &lt; members.size(); i++) {
              pstm.setInt(1, idGruppo);
              pstm.setInt(2, creator.getId());
              pstm.setString(3, groupName);
              part = DBUtils.findUser(members.get(i));
              pstm.setInt(4, part.getId());
              pstm.setTimestamp(5, timestamp);
              pstm.executeUpdate();
          }
  
          conn.close();
          return response;
  
      }
  </code></pre>
  
  <p>I want to send in body some parameters but I can't to figure out what is the syntact error made.</p>