Combination View Flat View Tree View
Threads [ Previous | Next ]
Cesar Quinteiro
Change Hibernate properties in Portal-ext.properties
December 24, 2012 10:15 AM
Answer

Cesar Quinteiro

Rank: Junior Member

Posts: 29

Join Date: October 18, 2011

Recent Posts

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
RE: Change Hibernate properties in Portal-ext.properties
January 21, 2013 4:55 AM
Answer

Cesar Quinteiro

Rank: Junior Member

Posts: 29

Join Date: October 18, 2011

Recent Posts

Any answer about this question?
Priyanka Dhingra
RE: Change Hibernate properties in Portal-ext.properties
January 21, 2013 5:04 AM
Answer

Priyanka Dhingra

Rank: Liferay Master

Posts: 501

Join Date: December 19, 2011

Recent Posts

this value is there in hibernate.cfg.xml
1<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
RE: Change Hibernate properties in Portal-ext.properties
January 21, 2013 7:18 AM
Answer

Cesar Quinteiro

Rank: Junior Member

Posts: 29

Join Date: October 18, 2011

Recent Posts

Priyanka Dhingra:
this value is there in hibernate.cfg.xml
1<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?
Priyanka Dhingra
RE: Change Hibernate properties in Portal-ext.properties
January 21, 2013 10:04 PM
Answer

Priyanka Dhingra

Rank: Liferay Master

Posts: 501

Join Date: December 19, 2011

Recent Posts

1. I think the thing you are looking for can be configured here
1 tomcat/conf/context.xml

2. check this
http://www.liferay.com/community/forums/-/message_boards/message/316717
Cesar Quinteiro
RE: Change Hibernate properties in Portal-ext.properties
January 22, 2013 3:43 AM
Answer

Cesar Quinteiro

Rank: Junior Member

Posts: 29

Join Date: October 18, 2011

Recent Posts

Priyanka Dhingra:
1. I think the thing you are looking for can be configured here
1 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