The relevant MySQL for the table:
<entity class="Foo" name="Foo" access="FIELD">
<table name="Foo"/>
<attributes>
<id name="id">
<column name="ID" nullable="false"/>
<generated-value strategy="SEQUENCE"/>
</id>
...
</table>
</entity>
CREATE TABLE FOORegardless of whether or not the id property was null or not, it was not updated after the following call to persist():
(
ID INT NOT NULL AUTO_INCREMENT,
...
PRIMARY KEY(ID)
)
Foo foo = new Foo();
getJpaTemplate().persist(foo);
if (logger.isDebugEnabled())
logger.debug(foo.getId()) // null
Adding a call to flush() however ended up giving me the id:
Foo foo = new Foo();I'm not sure why the flush() was necessary. A similar issue is also discussed here: Spring Forums Post.
getJpaTemplate().persist(foo);
getJpaTemplate().flush();
if (logger.isDebugEnabled())
logger.debug(foo.getId()) // outputs the assigned id
http://stackoverflow.com/questions/7206891/is-calling-persist-flush-and-refresh-in-one-method-to-persist-an-entity-th
ReplyDeleteBigJ
yurtdışı kargo
ReplyDeleteresimli magnet
instagram takipçi satın al
yurtdışı kargo
sms onay
dijital kartvizit
dijital kartvizit
https://nobetci-eczane.org/
QVF
Portekiz yurtdışı kargo
ReplyDeleteRomanya yurtdışı kargo
Slovakya yurtdışı kargo
Slovenya yurtdışı kargo
İngiltere yurtdışı kargo
RJART7
Angila yurtdışı kargo
ReplyDeleteAndora yurtdışı kargo
Arnavutluk yurtdışı kargo
Arjantin yurtdışı kargo
Antigua ve Barbuda yurtdışı kargo
VRKX
salt likit
ReplyDeletesalt likit
dr mood likit
big boss likit
dl likit
dark likit
YZEGQ