Failed to update using DataJpaTest spring boot 2.1.0












0















Using unit test for a spring boot parent 2.1.0. I need to test the update of values after applying update to a List object inside Game object. I read in another thread to add the following statement but could't use in my case




     @Modifying(clearAutomatically = true)



GameRepositoryTest.java



import com.game.kalah.domain.Game;
import static com.game.kalah.utils.Constants.*;
import static com.game.kalah.utils.Status.*;
import java.util.Arrays;
import java.util.Optional;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.context.junit4.SpringRunner;
//import static org.assertj.core.api.Assertions.*;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.ActiveProfiles;

/**
*
* @author Nesrin
*/
@RunWith(SpringRunner.class)
// DataJpaTest supports rollback after running every test case
@DataJpaTest
@ActiveProfiles("test")

public class GameRepositoryTest {

private Integer INITIAL_BOARD;
private Game testGame;
private static Game palyedGame;

@Autowired
TestEntityManager em;

@Autowired
private GameRepository repository;

@Before
public void setup() {
INITIAL_BOARD = new Integer{6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0};
testGame = new Game();
testGame.setBoardList(Arrays.asList(INITIAL_BOARD));
testGame.setStatus(PLAYER1TURN);
// testGame.setId(anyInt());
testGame.setMessage(START_MESSAGE);
testGame.setId(1);
fisrtPitPlayerOneMove();
}

@Test
public void test_save_game() {
// 1- Insert new game
Game newGame = repository.save(
new Game(START_MESSAGE)
);
// 2- Check saved game data for reporting
Optional<Game> retrieved = repository.findById(1);
Game savedGame = retrieved.get();

// playing with test options :)
/*
* return to a good reference
* https://objectpartners.com/2013/09/18/the-benefits-of-using-assertthat-over-other-assert-methods-in-unit-tests/
*/
//import static org.junit.Assert.*;
assertNotNull(newGame);
assertThat(newGame, isA(Game.class));
assertThat(savedGame, instanceOf(Game.class));
assertThat(testGame, is(newGame));
assertThat(testGame, equalTo(savedGame));
assertEquals(testGame, savedGame);
assertNotSame("Not Same", retrieved, testGame);
assertThat(testGame, sameInstance(testGame));
assertTrue(savedGame.equals(testGame));

//import static org.assertj.core.api.Assertions.*;
// assertThat(repository.findAll()).containsExactly(newGame);
savedGame.setBoardList(Arrays.asList(new Integer{0, 7, 7, 7, 7, 7, 1, 6, 6, 6, 6, 6, 6, 0}));
// 3- apply change on the saved game then save again to chek update effect
Game afterFirstMove = repository.save(savedGame);
assertNotNull(afterFirstMove);
assertThat(afterFirstMove, isA(Game.class));
assertEquals(savedGame, afterFirstMove);

}


private static void fisrtPitPlayerOneMove() {
palyedGame = new Game();
palyedGame.setId(1);
palyedGame.setMessage(IN_PROGRESS_MESSAGE + palyedGame.getId());
palyedGame.setStatus(PLAYER1TURN);
palyedGame.setBoardList(Arrays.asList(new Integer{0, 7, 7, 7, 7, 7, 1, 6, 6, 6, 6, 6, 6, 0}));

}
}


Game.java



@Data
@Entity
public class Game {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ElementCollection
@Column(name = "pits")
private List<Integer> boardList;
private Status status;
private String message;

public Game() {
}

public Game(String message) {
this.boardList = Arrays.asList(new Integer{6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0});
this.status = Status.PLAYER1TURN;
this.message = message;
}



}


GameRepository.java



import com.game.kalah.domain.Game;
import org.springframework.data.repository.CrudRepository;

/**
*
* @author Nesrin
*/
public interface GameRepository extends CrudRepository<Game, Integer> {
}


The error is as follows, which is at the line of calling save for the second time in the test class



 Game afterFirstMove = repository.save(savedGame);



test_save_game(com.game.kalah.repository.GameRepositoryTest) Time
elapsed: 0.106 s <<< ERROR! java.lang.UnsupportedOperationException
at
com.game.kalah.repository.GameRepositoryTest.test_save_game(GameRepositoryTest.java:85)




pom.xml parent part



 <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>









share|improve this question























  • What kind of data type you added at database for private List<Integer> boardList; ?????????????

    – flopcoder
    Nov 20 '18 at 5:44













  • It's already in Game.java ` @ElementCollection @Column(name = "pits") private List<Integer> boardList; `

    – Nesrin
    Nov 20 '18 at 12:17


















0















Using unit test for a spring boot parent 2.1.0. I need to test the update of values after applying update to a List object inside Game object. I read in another thread to add the following statement but could't use in my case




     @Modifying(clearAutomatically = true)



GameRepositoryTest.java



import com.game.kalah.domain.Game;
import static com.game.kalah.utils.Constants.*;
import static com.game.kalah.utils.Status.*;
import java.util.Arrays;
import java.util.Optional;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.context.junit4.SpringRunner;
//import static org.assertj.core.api.Assertions.*;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.ActiveProfiles;

/**
*
* @author Nesrin
*/
@RunWith(SpringRunner.class)
// DataJpaTest supports rollback after running every test case
@DataJpaTest
@ActiveProfiles("test")

public class GameRepositoryTest {

private Integer INITIAL_BOARD;
private Game testGame;
private static Game palyedGame;

@Autowired
TestEntityManager em;

@Autowired
private GameRepository repository;

@Before
public void setup() {
INITIAL_BOARD = new Integer{6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0};
testGame = new Game();
testGame.setBoardList(Arrays.asList(INITIAL_BOARD));
testGame.setStatus(PLAYER1TURN);
// testGame.setId(anyInt());
testGame.setMessage(START_MESSAGE);
testGame.setId(1);
fisrtPitPlayerOneMove();
}

@Test
public void test_save_game() {
// 1- Insert new game
Game newGame = repository.save(
new Game(START_MESSAGE)
);
// 2- Check saved game data for reporting
Optional<Game> retrieved = repository.findById(1);
Game savedGame = retrieved.get();

// playing with test options :)
/*
* return to a good reference
* https://objectpartners.com/2013/09/18/the-benefits-of-using-assertthat-over-other-assert-methods-in-unit-tests/
*/
//import static org.junit.Assert.*;
assertNotNull(newGame);
assertThat(newGame, isA(Game.class));
assertThat(savedGame, instanceOf(Game.class));
assertThat(testGame, is(newGame));
assertThat(testGame, equalTo(savedGame));
assertEquals(testGame, savedGame);
assertNotSame("Not Same", retrieved, testGame);
assertThat(testGame, sameInstance(testGame));
assertTrue(savedGame.equals(testGame));

//import static org.assertj.core.api.Assertions.*;
// assertThat(repository.findAll()).containsExactly(newGame);
savedGame.setBoardList(Arrays.asList(new Integer{0, 7, 7, 7, 7, 7, 1, 6, 6, 6, 6, 6, 6, 0}));
// 3- apply change on the saved game then save again to chek update effect
Game afterFirstMove = repository.save(savedGame);
assertNotNull(afterFirstMove);
assertThat(afterFirstMove, isA(Game.class));
assertEquals(savedGame, afterFirstMove);

}


private static void fisrtPitPlayerOneMove() {
palyedGame = new Game();
palyedGame.setId(1);
palyedGame.setMessage(IN_PROGRESS_MESSAGE + palyedGame.getId());
palyedGame.setStatus(PLAYER1TURN);
palyedGame.setBoardList(Arrays.asList(new Integer{0, 7, 7, 7, 7, 7, 1, 6, 6, 6, 6, 6, 6, 0}));

}
}


Game.java



@Data
@Entity
public class Game {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ElementCollection
@Column(name = "pits")
private List<Integer> boardList;
private Status status;
private String message;

public Game() {
}

public Game(String message) {
this.boardList = Arrays.asList(new Integer{6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0});
this.status = Status.PLAYER1TURN;
this.message = message;
}



}


GameRepository.java



import com.game.kalah.domain.Game;
import org.springframework.data.repository.CrudRepository;

/**
*
* @author Nesrin
*/
public interface GameRepository extends CrudRepository<Game, Integer> {
}


The error is as follows, which is at the line of calling save for the second time in the test class



 Game afterFirstMove = repository.save(savedGame);



test_save_game(com.game.kalah.repository.GameRepositoryTest) Time
elapsed: 0.106 s <<< ERROR! java.lang.UnsupportedOperationException
at
com.game.kalah.repository.GameRepositoryTest.test_save_game(GameRepositoryTest.java:85)




pom.xml parent part



 <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>









share|improve this question























  • What kind of data type you added at database for private List<Integer> boardList; ?????????????

    – flopcoder
    Nov 20 '18 at 5:44













  • It's already in Game.java ` @ElementCollection @Column(name = "pits") private List<Integer> boardList; `

    – Nesrin
    Nov 20 '18 at 12:17
















0












0








0








Using unit test for a spring boot parent 2.1.0. I need to test the update of values after applying update to a List object inside Game object. I read in another thread to add the following statement but could't use in my case




     @Modifying(clearAutomatically = true)



GameRepositoryTest.java



import com.game.kalah.domain.Game;
import static com.game.kalah.utils.Constants.*;
import static com.game.kalah.utils.Status.*;
import java.util.Arrays;
import java.util.Optional;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.context.junit4.SpringRunner;
//import static org.assertj.core.api.Assertions.*;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.ActiveProfiles;

/**
*
* @author Nesrin
*/
@RunWith(SpringRunner.class)
// DataJpaTest supports rollback after running every test case
@DataJpaTest
@ActiveProfiles("test")

public class GameRepositoryTest {

private Integer INITIAL_BOARD;
private Game testGame;
private static Game palyedGame;

@Autowired
TestEntityManager em;

@Autowired
private GameRepository repository;

@Before
public void setup() {
INITIAL_BOARD = new Integer{6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0};
testGame = new Game();
testGame.setBoardList(Arrays.asList(INITIAL_BOARD));
testGame.setStatus(PLAYER1TURN);
// testGame.setId(anyInt());
testGame.setMessage(START_MESSAGE);
testGame.setId(1);
fisrtPitPlayerOneMove();
}

@Test
public void test_save_game() {
// 1- Insert new game
Game newGame = repository.save(
new Game(START_MESSAGE)
);
// 2- Check saved game data for reporting
Optional<Game> retrieved = repository.findById(1);
Game savedGame = retrieved.get();

// playing with test options :)
/*
* return to a good reference
* https://objectpartners.com/2013/09/18/the-benefits-of-using-assertthat-over-other-assert-methods-in-unit-tests/
*/
//import static org.junit.Assert.*;
assertNotNull(newGame);
assertThat(newGame, isA(Game.class));
assertThat(savedGame, instanceOf(Game.class));
assertThat(testGame, is(newGame));
assertThat(testGame, equalTo(savedGame));
assertEquals(testGame, savedGame);
assertNotSame("Not Same", retrieved, testGame);
assertThat(testGame, sameInstance(testGame));
assertTrue(savedGame.equals(testGame));

//import static org.assertj.core.api.Assertions.*;
// assertThat(repository.findAll()).containsExactly(newGame);
savedGame.setBoardList(Arrays.asList(new Integer{0, 7, 7, 7, 7, 7, 1, 6, 6, 6, 6, 6, 6, 0}));
// 3- apply change on the saved game then save again to chek update effect
Game afterFirstMove = repository.save(savedGame);
assertNotNull(afterFirstMove);
assertThat(afterFirstMove, isA(Game.class));
assertEquals(savedGame, afterFirstMove);

}


private static void fisrtPitPlayerOneMove() {
palyedGame = new Game();
palyedGame.setId(1);
palyedGame.setMessage(IN_PROGRESS_MESSAGE + palyedGame.getId());
palyedGame.setStatus(PLAYER1TURN);
palyedGame.setBoardList(Arrays.asList(new Integer{0, 7, 7, 7, 7, 7, 1, 6, 6, 6, 6, 6, 6, 0}));

}
}


Game.java



@Data
@Entity
public class Game {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ElementCollection
@Column(name = "pits")
private List<Integer> boardList;
private Status status;
private String message;

public Game() {
}

public Game(String message) {
this.boardList = Arrays.asList(new Integer{6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0});
this.status = Status.PLAYER1TURN;
this.message = message;
}



}


GameRepository.java



import com.game.kalah.domain.Game;
import org.springframework.data.repository.CrudRepository;

/**
*
* @author Nesrin
*/
public interface GameRepository extends CrudRepository<Game, Integer> {
}


The error is as follows, which is at the line of calling save for the second time in the test class



 Game afterFirstMove = repository.save(savedGame);



test_save_game(com.game.kalah.repository.GameRepositoryTest) Time
elapsed: 0.106 s <<< ERROR! java.lang.UnsupportedOperationException
at
com.game.kalah.repository.GameRepositoryTest.test_save_game(GameRepositoryTest.java:85)




pom.xml parent part



 <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>









share|improve this question














Using unit test for a spring boot parent 2.1.0. I need to test the update of values after applying update to a List object inside Game object. I read in another thread to add the following statement but could't use in my case




     @Modifying(clearAutomatically = true)



GameRepositoryTest.java



import com.game.kalah.domain.Game;
import static com.game.kalah.utils.Constants.*;
import static com.game.kalah.utils.Status.*;
import java.util.Arrays;
import java.util.Optional;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.context.junit4.SpringRunner;
//import static org.assertj.core.api.Assertions.*;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.ActiveProfiles;

/**
*
* @author Nesrin
*/
@RunWith(SpringRunner.class)
// DataJpaTest supports rollback after running every test case
@DataJpaTest
@ActiveProfiles("test")

public class GameRepositoryTest {

private Integer INITIAL_BOARD;
private Game testGame;
private static Game palyedGame;

@Autowired
TestEntityManager em;

@Autowired
private GameRepository repository;

@Before
public void setup() {
INITIAL_BOARD = new Integer{6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0};
testGame = new Game();
testGame.setBoardList(Arrays.asList(INITIAL_BOARD));
testGame.setStatus(PLAYER1TURN);
// testGame.setId(anyInt());
testGame.setMessage(START_MESSAGE);
testGame.setId(1);
fisrtPitPlayerOneMove();
}

@Test
public void test_save_game() {
// 1- Insert new game
Game newGame = repository.save(
new Game(START_MESSAGE)
);
// 2- Check saved game data for reporting
Optional<Game> retrieved = repository.findById(1);
Game savedGame = retrieved.get();

// playing with test options :)
/*
* return to a good reference
* https://objectpartners.com/2013/09/18/the-benefits-of-using-assertthat-over-other-assert-methods-in-unit-tests/
*/
//import static org.junit.Assert.*;
assertNotNull(newGame);
assertThat(newGame, isA(Game.class));
assertThat(savedGame, instanceOf(Game.class));
assertThat(testGame, is(newGame));
assertThat(testGame, equalTo(savedGame));
assertEquals(testGame, savedGame);
assertNotSame("Not Same", retrieved, testGame);
assertThat(testGame, sameInstance(testGame));
assertTrue(savedGame.equals(testGame));

//import static org.assertj.core.api.Assertions.*;
// assertThat(repository.findAll()).containsExactly(newGame);
savedGame.setBoardList(Arrays.asList(new Integer{0, 7, 7, 7, 7, 7, 1, 6, 6, 6, 6, 6, 6, 0}));
// 3- apply change on the saved game then save again to chek update effect
Game afterFirstMove = repository.save(savedGame);
assertNotNull(afterFirstMove);
assertThat(afterFirstMove, isA(Game.class));
assertEquals(savedGame, afterFirstMove);

}


private static void fisrtPitPlayerOneMove() {
palyedGame = new Game();
palyedGame.setId(1);
palyedGame.setMessage(IN_PROGRESS_MESSAGE + palyedGame.getId());
palyedGame.setStatus(PLAYER1TURN);
palyedGame.setBoardList(Arrays.asList(new Integer{0, 7, 7, 7, 7, 7, 1, 6, 6, 6, 6, 6, 6, 0}));

}
}


Game.java



@Data
@Entity
public class Game {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ElementCollection
@Column(name = "pits")
private List<Integer> boardList;
private Status status;
private String message;

public Game() {
}

public Game(String message) {
this.boardList = Arrays.asList(new Integer{6, 6, 6, 6, 6, 6, 0, 6, 6, 6, 6, 6, 6, 0});
this.status = Status.PLAYER1TURN;
this.message = message;
}



}


GameRepository.java



import com.game.kalah.domain.Game;
import org.springframework.data.repository.CrudRepository;

/**
*
* @author Nesrin
*/
public interface GameRepository extends CrudRepository<Game, Integer> {
}


The error is as follows, which is at the line of calling save for the second time in the test class



 Game afterFirstMove = repository.save(savedGame);



test_save_game(com.game.kalah.repository.GameRepositoryTest) Time
elapsed: 0.106 s <<< ERROR! java.lang.UnsupportedOperationException
at
com.game.kalah.repository.GameRepositoryTest.test_save_game(GameRepositoryTest.java:85)




pom.xml parent part



 <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>






java spring spring-boot spring-boot-test






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 2:59









NesrinNesrin

535




535













  • What kind of data type you added at database for private List<Integer> boardList; ?????????????

    – flopcoder
    Nov 20 '18 at 5:44













  • It's already in Game.java ` @ElementCollection @Column(name = "pits") private List<Integer> boardList; `

    – Nesrin
    Nov 20 '18 at 12:17





















  • What kind of data type you added at database for private List<Integer> boardList; ?????????????

    – flopcoder
    Nov 20 '18 at 5:44













  • It's already in Game.java ` @ElementCollection @Column(name = "pits") private List<Integer> boardList; `

    – Nesrin
    Nov 20 '18 at 12:17



















What kind of data type you added at database for private List<Integer> boardList; ?????????????

– flopcoder
Nov 20 '18 at 5:44







What kind of data type you added at database for private List<Integer> boardList; ?????????????

– flopcoder
Nov 20 '18 at 5:44















It's already in Game.java ` @ElementCollection @Column(name = "pits") private List<Integer> boardList; `

– Nesrin
Nov 20 '18 at 12:17







It's already in Game.java ` @ElementCollection @Column(name = "pits") private List<Integer> boardList; `

– Nesrin
Nov 20 '18 at 12:17














1 Answer
1






active

oldest

votes


















1














Did you try use mutable list? Arrays.asList(array) creates an immutable list.



Try to use new ArrayList<>(Arrays.asList(array)). check this link



Also, it would be helpful if you post your whole error logs.






share|improve this answer
























  • It worked as a charm.

    – Nesrin
    Nov 20 '18 at 8:34











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385577%2ffailed-to-update-using-datajpatest-spring-boot-2-1-0%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Did you try use mutable list? Arrays.asList(array) creates an immutable list.



Try to use new ArrayList<>(Arrays.asList(array)). check this link



Also, it would be helpful if you post your whole error logs.






share|improve this answer
























  • It worked as a charm.

    – Nesrin
    Nov 20 '18 at 8:34
















1














Did you try use mutable list? Arrays.asList(array) creates an immutable list.



Try to use new ArrayList<>(Arrays.asList(array)). check this link



Also, it would be helpful if you post your whole error logs.






share|improve this answer
























  • It worked as a charm.

    – Nesrin
    Nov 20 '18 at 8:34














1












1








1







Did you try use mutable list? Arrays.asList(array) creates an immutable list.



Try to use new ArrayList<>(Arrays.asList(array)). check this link



Also, it would be helpful if you post your whole error logs.






share|improve this answer













Did you try use mutable list? Arrays.asList(array) creates an immutable list.



Try to use new ArrayList<>(Arrays.asList(array)). check this link



Also, it would be helpful if you post your whole error logs.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 4:36









applemangoapplemango

567




567













  • It worked as a charm.

    – Nesrin
    Nov 20 '18 at 8:34



















  • It worked as a charm.

    – Nesrin
    Nov 20 '18 at 8:34

















It worked as a charm.

– Nesrin
Nov 20 '18 at 8:34





It worked as a charm.

– Nesrin
Nov 20 '18 at 8:34


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53385577%2ffailed-to-update-using-datajpatest-spring-boot-2-1-0%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith