Foren

Portlet - criation of tables on startup

Joao Anacleto, geändert vor 12 Jahren.

Portlet - criation of tables on startup

New Member Beiträge: 2 Beitrittsdatum: 18.11.11 Neueste Beiträge
Hi everyone,

I'm trying understand the portlet instalation mechanism.

For testing purposes I create a portlet using SDK and I did the follow steps:

1) I create the service.xml file with the follow content:


<!--?xml version="1.0" encoding="UTF-8" ?-->


<service-builder package-path="com.exictos.service.builder.test">
	<author>Joao Anacleto</author>
	<namespace>PR</namespace>
	<entity name="Test" local-service="true" remote-service="false">
		<column name="productId" type="long" primary="true" />
	</entity>
</service-builder>


2) After that I create a service using ant target: ant build-service

3) Then I deploy the portlet using ant target: ant deploy

I noticed that table PR_Test was created in liferay database. How this automatism works? Liferay follow some conventions to find sql files? or this is done by configuring the Spring and Hibernate configurations present in srv/META-INF?

I'm asking this because I want to use another ORM framework.
thumbnail
Sandeep Nair, geändert vor 12 Jahren.

RE: Portlet - criation of tables on startup

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Whenever a plugin deploys a listener gets called, in this case PluginPackageHotDeployListener. In this class doInvokeDeploy gets called, which internally calls ServiceComponentLocalServiceImpl.initServiceComponent.

You can see the actual logic of upgradedb being called in ServiceComponentLocalServiceImpl

Regards,
sandeep