Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Vitaliy Koshelenko
Liferay global table
July 17, 2012 8:19 AM
Answer

Vitaliy Koshelenko

Rank: Regular Member

Posts: 222

Join Date: March 25, 2011

Recent Posts

Hi. I'm using liferay 6.1
I need to store some configuration parameters (key-value pairs) in DB. I have found 'global' table in liferay and the GlobalLocalServiceUtil class.
I can read data from it using GlobalLocalServiceUtil.getValue( {KEY} );
but I can't perform add or update - the addGlobal method requires parameter of type Global which is interface. Should I use GlobalImpl class as parameter? Any ideas?
David H Nebinger
RE: Liferay global table
July 17, 2012 8:34 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7252

Join Date: September 1, 2006

Recent Posts

If it is based upon ServiceBuilder, you call XxxLocalServiceUtil.createXxx(primary key) first, followed by XxxLocalServiceUtil.addXxx(instance).
Vitaliy Koshelenko
RE: Liferay global table
July 17, 2012 12:05 PM
Answer

Vitaliy Koshelenko

Rank: Regular Member

Posts: 222

Join Date: March 25, 2011

Recent Posts

Thanks for your reply, it works emoticon
Hitoshi Ozawa
RE: Liferay global table
July 20, 2012 9:00 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

I have found 'global' table in liferay and the GlobalLocalServiceUtil class


Sorry, but I don't see any "Global" table in my liferay 6.1.0 CE? Did you create it? I thought Expando was the preferred way to save user custom data.
David H Nebinger
RE: Liferay global table
July 20, 2012 9:05 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7252

Join Date: September 1, 2006

Recent Posts

I don't have one in mine, either.
Jack Bakker
RE: Liferay global table
July 21, 2012 6:41 AM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 645

Join Date: January 3, 2010

Recent Posts

global table is not in Liferay, however I generally use a 'global' table in a 2nd 'biz' database as an approach for name/value pairs that I can use to differentiate values from dev to staging to prod ; and to flip things into debug mode on the fly for custom portlets

isDebug
isOrderTest
isContactTest
isShipTest
debugEmailFrom
debugEmailTo

and so on
Jack Bakker
RE: Liferay global table
July 21, 2012 6:46 AM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 645

Join Date: January 3, 2010

Recent Posts

hey Vitaliy ; according to your linkedin you are with a Ukraine company that is looking at my code

it's a small world after all...
Hitoshi Ozawa
RE: Liferay global table
July 21, 2012 8:03 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

Thank you for the information. It is available on the net to download? What you did seems interesting.
Jack Bakker
RE: Liferay global table
July 22, 2012 6:02 AM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 645

Join Date: January 3, 2010

Recent Posts

There is nothing fancy about this. Just a 'global' table with a service.xml entity as below.


 1    <entity name="Global" table="global" data-source="myDataSource" local-service="true" remote-service="true" session-factory="mySessionFactory" tx-manager="myTransactionManager">
 2
 3        <column name="globalId" db-name="global_id" type="long" primary="true" id-type="sequence" id-param="global_id_seq"/>
 4
 5        <column name="name" type="String" />
 6        <column name="value" type="String" />
 7       
 8        <finder name="Name" return-type="Global" unique="true">
 9            <finder-column name="name" />
10        </finder>
11    </entity>
Hitoshi Ozawa
RE: Liferay global table
July 22, 2012 6:16 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

There is nothing fancy about this. Just a 'global' table with a service.xml entity as below.


Thank you for the information.
Vitaliy Koshelenko
RE: Liferay global table
July 23, 2012 9:43 AM
Answer

Vitaliy Koshelenko

Rank: Regular Member

Posts: 222

Join Date: March 25, 2011

Recent Posts

Hi, Jack.
Yes, I'm developer from AimProSoft company in Ukraine and I'm currently working on Collaborans project...
It was my mistake - I thought this was the Liferay's table emoticon
David H Nebinger
RE: Liferay global table
July 23, 2012 9:49 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 7252

Join Date: September 1, 2006

Recent Posts

The beauty of using ServiceBuilder, however, was that we could answer the question even without having the actual table! emoticon
Jack Bakker
RE: Liferay global table
July 23, 2012 3:50 PM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 645

Join Date: January 3, 2010

Recent Posts

Happy coding Vitaliy (btw, it is Liferay v6.0.6 not v6.1).
Vitaliy Koshelenko
RE: Liferay global table
July 24, 2012 1:18 AM
Answer

Vitaliy Koshelenko

Rank: Regular Member

Posts: 222

Join Date: March 25, 2011

Recent Posts

Thanks, Jack. Yes, you're right...