Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
MICHAIL MOUDATSOS
Deleted Entity Regenerated
December 27, 2011 7:25 AM
Answer

MICHAIL MOUDATSOS

Rank: Regular Member

Posts: 110

Join Date: October 4, 2011

Recent Posts

I ll try to be brief:

I started a portlet project with a certain set of entities defined in service.xml. After some time I decided to change my schema and remove two entities. I had also observed that the definition of entities in service.xml resulted in generation of corresponding tables in DB, if they did not exist. Unfortunately, after deleting those two entities I dint want anymore from service.xml and after manually deleting the corresponding tables from DB, these tables would regenerate upon restart of the application server!

I had started my project in LR CE 6.05 and this problem persisted somehow even when I migrated my project to the 6.0.6 sdk. I don't know which files/resources keep this info and obviously I 'migrated' them as well. Note that I have used the service builder many times after that change, for defining custom methods, finder methods ctra.

Thank you in advance
Sandeep Nair
RE: Deleted Entity Regenerated
December 27, 2011 9:45 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

After deleting the entities from service.xml make sure you do a build-service. Liferay uses sql files in your-portlet/docroot/WEB-INF/sql to generate tables.

After running tables.sql see that the create script for the entity that you deleted is not there in your-portlet/docroot/WEB-INF/sql/tables.sql folder

After deploying check in webapps/yourportlet/WEB-INF/sql the tables.sql has the change reflected. If not then delete the portlet from webapps and deploy again

Regards,
Sandeep
MICHAIL MOUDATSOS
RE: Deleted Entity Regenerated
December 28, 2011 12:15 AM
Answer

MICHAIL MOUDATSOS

Rank: Regular Member

Posts: 110

Join Date: October 4, 2011

Recent Posts

Sandeep Nair:
After deleting the entities from service.xml make sure you do a build-service.

->
MICHAIL MOUDATSOS:
Note that I have used the service builder many times after that change, for defining custom methods, finder methods ctra


Now you were right on:
Sandeep Nair:
After running tables.sql see that the create script for the entity that you deleted is not there in your-portlet/docroot/WEB-INF/sql/tables.sql

meaning that, the problem WAS actually there. Although I ve run the ant build-service hundred of times in order to apply changes on ServiceImpl classes and definitions of finders I needed on the way, the definitions of the old, deleted entities were not removed from docroot/WEB-INF/sql/tables.sql. Is this a bug?

Would you advise me to delete the file and run ant build-service one more time or will this produce other side effects that might cause me problems (even minor ones) taking into account that I use a version control system for my files (not binary of course)?

Thank you in advance
Sandeep Nair
RE: Deleted Entity Regenerated
December 28, 2011 1:01 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1721

Join Date: November 5, 2008

Recent Posts

Yes I would advice you to delete sql files and run build-service again. There is no side effect in doing that AFIK.

Regards,
Sandeep