Skip to content
Advertisement

CrudRepository doesn’t save data

I’m having trouble while saving new object into database via CrudRepository. Interesting thing is that I can read data from repository.

So, while I’m getting data, I have an SQL query in console. While I’m saving data, console is empty. Moreover, CrudRepository.save returns a valid object, with assigned id.

Could you please take a look? Thanks you in advance.

controller class:

JavaScript

entity class:

JavaScript

sql where table is created:

JavaScript

and java-based configuration:

JavaScript

User repository:

JavaScript

Also screen with project structure is attachedProject structure

Please let me know if any additional info is required.

Advertisement

Answer

I think this config is wrong:

JavaScript

You must call getObject() on the EntityManagerFactory:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement