Spring JdbcTemplate - Insert blob and return generated key

后端 未结 11 1845
猫巷女王i
猫巷女王i 2020-12-15 06:06

From the Spring JDBC documentation, I know how to insert a blob using JdbcTemplate

final File blobIn = new File(\"spring2004.jpg\");
final InputStream blobIs         


        
11条回答
  •  别那么骄傲
    2020-12-15 06:21

    In case your underlying database is mysql, you can autogenerate your primary key. Then to insert a record into your db, you can use the following syntax for insertion:

    INSERT INTO lob_table (a_blob) VALUES (?)
    

提交回复
热议问题