zhurandy / portal-issues-test

0 stars 0 forks source link

ServiceBuilder doesn't support one-to-one relationships out of the box #172

Open zhurandy opened 10 years ago

zhurandy commented 10 years ago

Service builder doesn't work as expected when trying to generate a one-to-one relation between two entities defined in the same service.xml file. Consider the next service.xml snip:

Then generation fails with the following output: [java] Error on line 68, column 33 in com/liferay/portal/tools/servicebuilder/dependencies/model_impl.ftl [java] serviceBuilder.getSqlType(packagePath + ".model." + entity.getName(), column.getName(), column.getType()) is undefined. [java] It cannot be assigned to sqlType [java] The problematic instruction: [java] ---------- [java] ==> assignment: sqlType=serviceBuilder.getSqlType(packagePath + ".model." + entity.getName(), column.getName(), column.getType()) [on line 68, column 33 in com/liferay/portal/tools/servicebuilder/dependencies/model_impl.ftl] [java] ---------- [java] Java backtrace for programmers: [java] ---------- [java] freemarker.core.InvalidReferenceException: Error on line 68, column 33 in com/liferay/portal/tools/servicebuilder/dependencies/model_impl.ftl [java] serviceBuilder.getSqlType(packagePath + ".model." + entity.getName(), column.getName(), column.getType()) is undefined. [java] It cannot be assigned to sqlType [java] at freemarker.core.Assignment.accept(Assignment.java:111) The expected behaviour should be having a generated method like getProducto(). I suspect this can't also be done between entities in different services: http://www.liferay.com/web/guest/community/forums/-/message_boards/message/480294#_19_message_782016, but haven't tried nor found a ticket about this forum post.