Hey, I’m used to ORM so I have huge absence of sql experience. I want to know what is the best way to insert a row into a table, that is in many-to-many relationship with another table, and within the one statement also insert a row of two foreign keys into the particular linking table to preserve data integrity.
If anybody is using spring jdbcTemplate, I’d also want to know whether it has a support for this task. Thanks in advance
That’s typically what stored procedures are used for, eg something like
(assuming sql server)
Then google BEGIN TRAN, COMMIT TRAN and ROLLBACK.