留言板

Change Hibernate properties in Portal-ext.properties

Cesar Quinteiro,修改在11 年前。

Change Hibernate properties in Portal-ext.properties

Junior Member 帖子: 34 加入日期: 11-10-18 最近的帖子
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,修改在11 年前。

RE: Change Hibernate properties in Portal-ext.properties

Junior Member 帖子: 34 加入日期: 11-10-18 最近的帖子
Any answer about this question?
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: Change Hibernate properties in Portal-ext.properties

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
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,修改在11 年前。

RE: Change Hibernate properties in Portal-ext.properties

Junior Member 帖子: 34 加入日期: 11-10-18 最近的帖子
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,修改在11 年前。

RE: Change Hibernate properties in Portal-ext.properties

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
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,修改在11 年前。

RE: Change Hibernate properties in Portal-ext.properties

Junior Member 帖子: 34 加入日期: 11-10-18 最近的帖子
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