Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Tim Cardwell
Creating tables using the Liferay Service Builder
August 2, 2012 2:25 PM
Answer

Tim Cardwell

Rank: Junior Member

Posts: 30

Join Date: July 19, 2012

Recent Posts

I am creating a service that returns a list of items that changes with every call to the service. For this reason I don't need a table created by Liferay. I plan to build a list of items and return them in JSON format myself.

So my question is, if I don't declare an entity in service.xml, will a table be created when the service is called? Or is there a properties file that I can edit that will turn off the table's creation?

Thanks,
-Tim
Hitoshi Ozawa
RE: Creating tables using the Liferay Service Builder
August 2, 2012 2:37 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

If you don't have any entity why use service builder? You can just use portlet:resourceURL to return your JSON.
David H Nebinger
RE: Creating tables using the Liferay Service Builder
August 3, 2012 5:55 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11770

Join Date: September 1, 2006

Recent Posts

Tim Cardwell:
So my question is, if I don't declare an entity in service.xml, will a table be created when the service is called? Or is there a properties file that I can edit that will turn off the table's creation?


If you define an entity w/ no columns, you do not get a table. Unfortunately this means that methods that you add to XxxLocalServiceImpl or XxxServiceImpl can only return simple primitives or Strings.

As to why to use SB when you have no columns, it can be a great place to implement a shared code module for sharing amongst all deployed plugins.

Personally I'd like to see a flag on the entity indicating it is a DB entity or not. That way I could mark it as 'not db', yet still have most of the same functionality as SB currently generates (interfaces for the pojos, services, etc. and classes for the implementations, the class loader proxies, the Util classes, etc). Until that day comes, you're stuck w/ the primitives...