Tribune

Home » Liferay Portal » English » 6. Portal Framework

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Richard Oliver Legendi
Service builder creating database
16 dicembre 2009 3.38
Risposta

Richard Oliver Legendi

Punteggio: Junior Member

Messaggi: 35

Data di Iscrizione: 30 novembre 2009

Messaggi recenti

Hi! I'm currently learning how the service builder works, and I've encountered a strange behaviour.

I was able to create a simple portlet and service with the help of this tutorial.

It was working perfectly, however I started playing with it. I extended the table with a new column, and I thought it would be ok to drop the recent table. When I redeployed the portlet containing the service, it wrote the line:

116:21:18,312 INFO  [ServiceComponentLocalServiceImpl:281] Upgrading DummyTimeseries database to build number 40


But it haven't recreated the database, the following line was NOT included in the log, as it was when I first deployed the portlet:

116:21:18,312 INFO  [ServiceComponentLocalServiceImpl:290] Upgrading database with tables.sql


As a result I kept gaining an error, saying "no such table exists".

I was able to fix the issue whit renaming the database in the service.xml descriptor as a workaround. In this case the database is created after I rebuild and redeploy the application. Any other suggestions how could I make Liferay to recreate the database automatically?
András Róbert Imre
RE: Service builder creating database
19 dicembre 2009 11.45
Risposta

András Róbert Imre

Punteggio: New Member

Messaggi: 4

Data di Iscrizione: 1 dicembre 2009

Messaggi recenti

Hi,

You may have a look at the servicecomponent table. It seems that Liferay uses it to keep track of tables, indices etc. related to components (entities). You should be able to see the create section for both tables (the renamed one and the original one) in the _data column value.

If you deleted a component's table, you can wipe the rows for that component:
delete FROM servicecomponent where buildNamespace="DummyTimeseries"

Next time you start Liferay, all create scripts should be executed for DummyTimeseries. Existing tables do not get overwritten.

You may also have a look at the source of ServiceBuilder (how Liferay processes tables.sql etc.) and the build-service ant target.