掲示板

Cant Store Entities with composite primary key

thumbnail
12年前 に Daniel Breitner によって更新されました。

Cant Store Entities with composite primary key

Regular Member 投稿: 105 参加年月日: 08/07/16 最新の投稿
Hi you all !

Quick question:

I defined a Service Entity like this:

<entity name="Test" local-service="true" remote-service="false">
        <column name="part1" type="long" primary="true" />
        <column name="part2" type="long" primary="true" />
        <column name="part3" type="long" />
    </entity>


"part1" and "part2" are forming a Primary key.

A class called TestPK has already been created for me.

To store a new "Test" object, I need first to create a new TestPK and use it to store the Test object.

TestPK testpk= new TestPK(someValue, anotherValue);
TestLocalServiceUtil.createTest(testpk)



But whenever I do this I get the following exception:

21:26:12,708 ERROR [ClassLoaderProxy:70] java.lang.IllegalArgumentException: argument type mismatch
java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.liferay.portal.kernel.util.ClassLoaderProxy._invoke(ClassLoaderProxy.java:246)
thumbnail
12年前 に Daniel Breitner によって更新されました。

RE: Cant Store Entities with composite primary key

Regular Member 投稿: 105 参加年月日: 08/07/16 最新の投稿
Does nobody have an answer ?
thumbnail
12年前 に Sandeep Nair によって更新されました。

RE: Cant Store Entities with composite primary key

Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
Can you attach complete stacktrace please and also it would help if you tell which version of Liferay are you using

Regards,
Sandeep
thumbnail
12年前 に Daniel Breitner によって更新されました。

RE: Cant Store Entities with composite primary key

Regular Member 投稿: 105 参加年月日: 08/07/16 最新の投稿
Hi,

I just fixed it.

The issue was that we were using the XYZ_PK class outside the implementation package of the generated service.

As soon as I added the call to the XYZ_LocalServiceImpl class, it worked.