To dump a database:
$ mysqldump -uroot -ppassword mydb > mydb.mysqlTo recreate the database:
$ mysqladmin -uroot -ppassword drop mydb
$ mysqladmin -uroot -ppassword create mydb
$ mysql -uroot -ppassword mydb < mydb.mysql
$ mysqldump -uroot -ppassword mydb > mydb.mysqlTo recreate the database:
$ mysqladmin -uroot -ppassword drop mydb
$ mysqladmin -uroot -ppassword create mydb
$ mysql -uroot -ppassword mydb < mydb.mysql
$ sudo cpan ppI got this error:
/usr/bin/ld: cannot find -lperlI saw a suggestion to install libperl-dev, but I had that package already up-to-date.
collect2: ld returned 1 exit status
make[1]: *** [par] Error 1
make[1]: Leaving directory `/home/prystasj/.cpan/build/PAR-Packer-0.982-zX8GIO/myldr'
make: *** [subdirs] Error 2
SMUELLER/PAR-Packer-0.982.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
lrwxrwxrwx 1 root root 15 2009-01-23 15:28 /usr/lib/libperl.so -> libperl.so.5.10To:
lrwxrwxrwx 1 root root 15 2009-01-23 15:28 /usr/lib/libperl.so -> libperl.so.5.10.0I was able to install pp:
$ which pp
/usr/local/bin/pp
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
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