Fórum

Change Hibernate properties in Portal-ext.properties

Cesar Quinteiro, modificado 11 Anos atrás.

Change Hibernate properties in Portal-ext.properties

Junior Member Postagens: 34 Data de Entrada: 18/10/11 Postagens Recentes
I am able to change hibernate properties in Portal-ext.properties as by example :

hibernate.show_sql=false

that I tested and works fine , But How can I change another Hibernate properties?, in particular:
I want to change the property:
hibernate.current_session_context_class

If is not possible to change in the Portal-ext.properties file, What else can I do to get a custom value there,
If Liferay is using a particular class, for that property, can I extended and use my own class, how?
Cesar Quinteiro, modificado 11 Anos atrás.

RE: Change Hibernate properties in Portal-ext.properties

Junior Member Postagens: 34 Data de Entrada: 18/10/11 Postagens Recentes
Any answer about this question?
thumbnail
Priyanka Dhingra, modificado 11 Anos atrás.

RE: Change Hibernate properties in Portal-ext.properties

Liferay Master Postagens: 501 Data de Entrada: 20/12/11 Postagens Recentes
this value is there in hibernate.cfg.xml
<property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>


You can change the database settings by modifying /WEB-INF/classes/hibernate.cfg.xml.
Cesar Quinteiro, modificado 11 Anos atrás.

RE: Change Hibernate properties in Portal-ext.properties

Junior Member Postagens: 34 Data de Entrada: 18/10/11 Postagens Recentes
Priyanka Dhingra:
this value is there in hibernate.cfg.xml
<property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>


You can change the database settings by modifying /WEB-INF/classes/hibernate.cfg.xml.



thanks for the quick answer,
what is exactly the path for the file hibernate.cfg.xml you mention?
I have similar ones for my own portlets,
but where is the generic one of liferay to handle liferay's tables persistence?
thumbnail
Priyanka Dhingra, modificado 11 Anos atrás.

RE: Change Hibernate properties in Portal-ext.properties

Liferay Master Postagens: 501 Data de Entrada: 20/12/11 Postagens Recentes
1. I think the thing you are looking for can be configured here
 tomcat/conf/context.xml

2. check this
http://www.liferay.com/community/forums/-/message_boards/message/316717
Cesar Quinteiro, modificado 11 Anos atrás.

RE: Change Hibernate properties in Portal-ext.properties

Junior Member Postagens: 34 Data de Entrada: 18/10/11 Postagens Recentes
Priyanka Dhingra:
1. I think the thing you are looking for can be configured here
 tomcat/conf/context.xml

2. check this
http://www.liferay.com/community/forums/-/message_boards/message/316717


I tried that, but is not what I am searching for, What is suggesting there (in 2.) is to have a only one Hibernta.cfg.xml for custom portlets, but I don´t need that, What I need is to activate that property for Liferay Tables, by example "CalEvent", in the way that each time a transition occurs with that table, then I listen to it and do something else and you can do that just putting a class in the property : (by example)
<property name="hibernate.current_session_context_class">com.autobizlogic.abl.session.LogicThreadLocalSessionContext</property>
instead of
<property name="hibernate.current_session_context_class">thread</property>

In other words, I want to listen to the transactions (Insert, Update or Delete), that occurs in the Liferay's tables, and in a environment that is using Hibernate as persistence layer is as simple as changing that mention property, in theory is possible to do in a properties file, but that property, doesn't appears

see here