Foros de discusión

Portlet - criation of tables on startup

Joao Anacleto, modificado hace 12 años.

Portlet - criation of tables on startup

New Member Mensajes: 2 Fecha de incorporación: 18/11/11 Mensajes recientes
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, modificado hace 12 años.

RE: Portlet - criation of tables on startup

Liferay Legend Mensajes: 1744 Fecha de incorporación: 6/11/08 Mensajes recientes
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