views:

266

answers:

1

Hi,

I've created a JSR-268 portlet for Liferay which uses services to interact with a database. I can deploy the portlet without problems or errors, but the table defined by the services is not created!

I get no "table not found" error when I test the portlet. I get no errors at all! The table just isn't there in the database. I've found other things on the internet saying that I should use the generated "create.sql" file that the Liferay Service Builder created, but I don't see that file anywhere.

Can someone help me out?

Thanks for any response.

Kinds regards, Sweepee

A: 

Have the tables never been created? I had a similar problem when I deleted the tables by hand. I thought they would be created again when deploying the portlet again, but it didn't happen.

After studying the source code I found out that Liferay stores information about the portlets in the table servicecomponent and checks 2 things before it executes the (pseudo) SQL in META-INF/tables.sql:

  1. The build.number in service.properties must be higher than that, stored in servicecomponent,
  2. The tables.sql must be different from that, stored servicecomponent.

Only than, the tables.sql is executed.

An easy way to achive that, is to delete all entries in servicecomponent addressing your portlet.

Ridcully