nurkiewicz / spring-data-jdbc-repository

Spring Data JDBC generic DAO implementation
275 stars 151 forks source link

Returning values from the database (besides the id) #13

Closed JoeJErnst closed 10 years ago

JoeJErnst commented 10 years ago

I need to return values that are set by the database as default values (e.g. created and updated timestamps). I thought doing a findOne() inside postCreate() or postUpdate() would work, but I'm not getting back the expected values.

I'm not sure if the calls to postCreate and postUpdate are in the wrong transaction scope, or if perhaps they're asynchronous and therefore called before the database has been updated.

How would you return database-defaulted values when creating or updating entities?

JoeJErnst commented 10 years ago

The problem was with my JUnit tests. It works fine.