habuma / spring-in-action-5-samples

Home for example code from Spring in Action 5.
Apache License 2.0
1.21k stars 1.04k forks source link

Compilation error in JdbcTecoRepository #114

Closed harshad-sat closed 2 years ago

harshad-sat commented 2 years ago

getting compilation error in saveTacoInfo method for Arrays.AsList he method asList(Object) in the type Arrays is not applicable for the arguments (String, Timestamp)

harshad-sat commented 2 years ago

corrected it myself

Object[] objArry={taco.getName(), new Timestamp(taco.getCreatedAt().getTime())}; PreparedStatementCreator psc = new PreparedStatementCreatorFactory( "insert into Taco (name, createdAt) values (?, ?)", Types.VARCHAR, Types.TIMESTAMP ).newPreparedStatementCreator( Arrays.asList(objArry));

Not sure why it gives compilation error if this objArr is passed directly