Liferay Portlet:如何从现有数据库生成service.xml(服务生成器) [英] Liferay Portlet: How to generate service.xml (service builder) from existing database

查看:112
本文介绍了Liferay Portlet:如何从现有数据库生成service.xml(服务生成器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是liferay的新手,任何人都可以建议一些方法为现有数据库生成service.xml

I am new to liferay, Can anyone please suggest some way to generate the service.xml for existing database Discussion on Liferay Website . I hope people might have developed some way or liferay have developed some plugin for this.

推荐答案

我看不到将servicebuilder引入大型现有数据库中的特殊用途:您可以将servicebuilder实体连接到旧版数据源"或旧版表"(可以很好地进行搜索)条款),但AFAIK尚未完成service.xml的生成.

I see no particular use in introducing servicebuilder to large existing databases: You can connect servicebuilder entities to "legacy datasources" or "legacy tables" (those make good search terms) but service.xml generation has not been done AFAIK.

这种方法的一些问题是:

Some problem with this approach are:

  • servicebuilder对数据库中的操作具有某些假设.这样做可以封装Liferay运行的所有不同数据库,因此可能不会最大限度地使用每个数据库.
  • 如果您有一个大型的现有数据库,则可能有很多现有的业务逻辑来确保正确的数据进出数据库.您甚至可以使用存储过程等.
  • 虽然可以使Servicebuilder与存储过程一起使用,但必须引入自定义sql来解决Servicebuilder的假设.明确的外键关系也是如此.

我的建议是在现有的业务逻辑上有一个适当的接口,例如Webservice,JSON,Rest,无论什么流行.然后在Liferay的portlet中使用此界面.

My recommendation is to rather have a proper interface on the existing business logic, e.g. Webservice, JSON, Rest, whatever is popular. Then use this interface in Liferay's portlets.

另一种选择可能是将现有的持久性代码引入Liferay,仅公开服务而不使用Servicebuilder的持久性功能.为此,您只需定义空的<entity>块(带有名称等).这将生成适当的DoSomethingLocalService,但是省略了持久性实现-您可以将现有代码连接到这些服务中.

Another option might be to bring the existing persistence code into Liferay and just expose services without making use of the persistence features of Servicebuilder. For this you'd just define empty <entity> blocks (with names etc). This will generate the appropriate DoSomethingLocalService, but omit the persistence implementation - and you can wire your existing code in these services.

这篇关于Liferay Portlet:如何从现有数据库生成service.xml(服务生成器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆