mysql - Spring Dao says bad SQL grammar - syntax error -
org.springframework.jdbc.badsqlgrammarexception: preparedstatementcallback; bad sql grammar [delete model_state_history model_state_history inner bring together model on model_state_history.model_id = model.id model.package_id = ?]; nested exception org.h2.jdbc.jdbcsqlexception: syntax error in sql statement "delete model_state_history from[*] model_state_history inner bring together model on model_state_history.model_id = model.id model.package_id = ? "; sql statement:
and throws above in output. eyes, don't see syntax error. using mysql database. there wrong in sql syntax above?
using delete syntax gives syntax error too.
org.springframework.jdbc.badsqlgrammarexception: preparedstatementcallback; bad sql grammar [delete model_state_history inner bring together model on model_state_history.model_id = model.id model.package_id = ?]; nested exception org.h2.jdbc.jdbcsqlexception: syntax error in sql statement "delete model_state_history inner[*] bring together model on model_state_history.model_id = model.id model.package_id = ? "; sql statement: delete model_state_history inner bring together model on model_state_history.model_id = model.id model.package_id = ? [42000-176]
and piece of code beingness run
@transactional private int deleteallmodels(long packageid) throws dataaccessexception { homecoming new namedparameterjdbctemplate(datasource).update( "delete model_state_history inner bring together model on model_state_history.version_id = model.id model.package_id = :package_id", immutablemap.of("package_id", packageid));
on sec thought, think might have problem bring together syntax. you're writing
delete ... inner bring together ... on msh.version_id = m.id where m.package_id = :package_id
i'd think where
should and
instead, query become:
"delete model_state_history inner bring together model on model_state_history.version_id = model.id , model.package_id = :package_id"
since where
refers delete
statement, doesn't have model
table in it's "scope".
cheers,
mysql spring
No comments:
Post a Comment