Re: JDBC Transactions

Поиск
Список
Период
Сортировка
От Jonathan Tripathy
Тема Re: JDBC Transactions
Дата
Msg-id 4CCF0939.5000006@abpni.co.uk
обсуждение исходный текст
Ответ на Re: JDBC Transactions  (Filip Rembiałkowski <filip.rembialkowski@gmail.com>)
Ответы Re: JDBC Transactions  (Jonathan Tripathy <jonnyt@abpni.co.uk>)
Re: JDBC Transactions  (Andy Colson <andy@squeakycode.net>)
Список pgsql-general
>> Hi Andy,
>>
>> Thanks for your reply. Would the above code be classed as a single
>> transaction then?
> Yes, assuming there's no explicit transaction control
> (COMMIT/ROLLBACK/END) in your queries.
Actually, we do have maybe one or 2 queries that use ROLLBACK, however
ROLLBACK happens at the end of a "code block" so the question is
probably moot.
>> And if so, I could just simple leave out the line which
>> says "//Insert SQL here to lock table"?
> In PostgreSQL, locking is done automatically depending on actual
> isolation level and SQL queries.
> You can use explicit locking but most of the time it's not needed.
>
I'll give you the exact case where I'm worried:

We have a table of customers, and each customer can have multiple
memberships (which are stored in the memberships table). We want our
deleteMembership(int membershipID) method to remove the membership, then
check to see if there are no more memberships left for the corresponding
customer, and if there are none, delete the corresponding customer as well.

В списке pgsql-general по дате отправления:

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Why so many xlogs?
Следующее
От: Jonathan Tripathy
Дата:
Сообщение: Re: JDBC Transactions