[GENERAL] How to get transaction started always in WRITE mode.

Поиск
Список
Период
Сортировка
От Adam Šlachta
Тема [GENERAL] How to get transaction started always in WRITE mode.
Дата
Msg-id 08b61188-64f9-421a-996b-9ace3f8f4f4f@xitee.com
обсуждение исходный текст
Ответы Re: [GENERAL] How to get transaction started always in WRITE mode.
Re: [GENERAL] How to get transaction started always in WRITE mode.
Список pgsql-general

Hello,

 

In short: Is there any way how to setup PostgreSql 9.6 to always start a transaction in WRITE mode?

 

Our related configuration:

"default_transaction_isolation" --> "read committed"

"default_transaction_read_only" --> "off"

 

 

Longer description (for those who are interested, since it is not only PostgreSQL related):

 

We are facing problems with "cannot execute <UPDATE/INSERT/DELETE> in a read-only transaction" exception (org.postgresql.util.PSQLException).

It is very likely the problem is caused by our code, however at the moment the fastest solution before we solve the things properly would be to setup WRITE mode for all started transactions on a database-setup-level.

 

SW we use:

-> Java 8

-> Hibernate 5.1.2

-> spring-data-jpa 1.10.4.RELEASE

-> spring-beans, spring-core, other spring stuff of version 4.2.8.RELEASE

 

Related configuration (I don't want to spam here with long list of configuration files so I pick-up what I consider important):

Hibernate -> first & second level cache switched OFF

SessionFactory -> org.springframework.orm.hibernate5.LocalSessionFactoryBean

transactionManager -> org.springframework.orm.jpa.JpaTransactionManager

Spring @Transactional(read-only) hint -> where we could we set it to "false"

Our typical @Repository extends org.springframework.data.jpa.repository.JpaRepository, which uses implementation from org.springframework.data.jpa.repository.support.SimpleJpaRepository.

 

Thank you very much for any hints.

Adam Slachta




-------------------------------------------
This e-mail message including any attachments is for the sole use of the intended recipient(s) and may contain privileged or confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please immediately contact the sender by reply e-mail and delete the original message and destroy all copies thereof.

Tato zpráva včetně veškerých příloh je důvěrná a mohou ji využít pouze osoby, jimž je adresována. Nejste-li adresátem zprávy, obsah i s přílohami a kopiemi bezodkladně odstraňte ze svého systému a dále ji nijak nevyužívejte. Upozorňujeme Vás, že využívání zpráv, které Vám nejsou určeny, je zakázáno, včetně jejich přímého či nepřímého zveřejňování, kopírování, tištění, rozšiřování anebo jakéhokoli právního jednání učiněného při spoléhání se na jejich obsah. Pokud jste zprávu obdrželi omylem, postupujte stejně a neprodleně informujte odesílatele.

Der Inhalt dieser E-Mail ist vertraulich und ausschließlich für den bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat dieser E-Mail oder dessen Vertreter sein sollten, so beachten Sie bitte, dass jede Form der Kenntnisnahme, Veröffentlichung, Vervielfältigung oder Weitergabe des Inhalts dieser E-Mail unzulässig ist. Wir bitten Sie, sich in diesem Fall mit dem Absender der E-Mail in Verbindung zu setzen.

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

Предыдущее
От: Dmitry Lazurkin
Дата:
Сообщение: Re: [GENERAL] Perfomance of IN-clause with many elements and possiblesolutions
Следующее
От: Thomas Güttler
Дата:
Сообщение: [GENERAL] Row based permissions: at DB or at Application level?