'Which property of Persistence.xml can do Hibernate Configuration as Readonly.?

I am using Hibernate Configuration in my persistence.xml. I want two persistence units. One for persisting or editing to the db. And the second persistence unit` will only have read access to db.

Database-readonly will be able to perform Only Read Operation to database.

<persistence-unit name="Database-readonly">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
        <validation-mode>CALLBACK</validation-mode>
        <properties>
        .........
        .........
       <properties>

Database-Persist will be able to perform editing to database (persist, modify or delete)

<persistence-unit name="Database-Persist">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
        <validation-mode>CALLBACK</validation-mode>
        <properties>
        .........
        .........
       <properties>

Is there any property in Hibernate configuration that will enable me to implement this ??.

I want to implement this because at the time of reading no transactional lock will be enabled to the database, which means multiple reading can be enabled to the EntityManager.

Question :- Is there any property in Hibernate configuration that will enable me to implement this ??.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source