Saya ingin menambahkan tabel ke database saya menggunakan FreeMarker. Saya mencoba menggunakan ExpandoTableLocalServiceUtil kelas di template saya:
<#assign expandoTable = staticUtil["com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil"] />
lalu saya mencoba menambahkan tabel:
<#assign table = expandoTable.addTable(theme_display.getCompanyId(),"", "MYTABLE") />
Tapi tabelnya tidak ditambahkan.
Saya juga mencoba dengan cara ini:
${expandoTable.addTable(theme_display.getCompanyId(),"", "ANOTHER-TABLE")}
Dan saya mendapatkan kesalahan ini:
Template processing error: "Method public static
com.liferay.portlet.expando.model.ExpandoTable
com.liferay.portlet.expando.service.ExpandoTableLocalServiceUtil.addTable(long,java.lang.String,java.lang.String) throws
com.liferay.portal.kernel.exception.PortalException,com.liferay.portal.kernel.exception.SystemException threw an exception"
The problematic instruction:
----------
==> ${expandoTable.addTable(theme_display.getCompanyId(),"", "ANOTHER-TABLE")} [on line 22, column 1 in eventi-theme_SERVLET_CONTEXT_/templates/portal_normal.ftl]
----------
Caused by: com.liferay.portlet.expando.DuplicateTableNameException: {tableId=0}
DuplicateTableNameException
? - person Tobias Liefke   schedule 25.11.2015