掲示板
Can`t Store Liferay Service Entity ´with composite primary key
12年前 に Daniel Breitner によって更新されました。
Can`t Store Liferay Service Entity ´with composite primary key
Regular Member 投稿: 105 参加年月日: 08/07/16 最新の投稿
Hi you all !
Quick question:
I defined a Service Entity like this:
"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.
But whenever I do this I get the following exception:
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)
12年前 に Alexey Kakunin によって更新されました。
RE: Can`t Store Liferay Service Entity ´with composite primary key
Liferay Master 投稿: 621 参加年月日: 08/07/07 最新の投稿
Hi Daniel!
Since ClassLoaderProxy used, I suppose you defined services in one portlet - and trying to use them from another portlet.
Is it your situation?
==
Alexey Kakunin
EmDev Limited
Since ClassLoaderProxy used, I suppose you defined services in one portlet - and trying to use them from another portlet.
Is it your situation?
==
Alexey Kakunin
EmDev Limited
12年前 に Joaquin Cabal によって更新されました。
RE: Can`t Store Liferay Service Entity ´with composite primary key
Regular Member 投稿: 106 参加年月日: 09/09/07 最新の投稿
Hi Daniel, What Liferay version are you using?
11年前 に Harish Kumar によって更新されました。
RE: Can`t Store Liferay Service Entity ´with composite primary key
Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
Hi Daniel!
I've used the same and its working fine.
I am using LR 6.1EE and defined services in one portlet and accessing in another portlet.
I've used the same and its working fine.
I am using LR 6.1EE and defined services in one portlet and accessing in another portlet.
11年前 に David H Nebinger によって更新されました。
RE: Can`t Store Liferay Service Entity ´with composite primary key
Liferay Legend 投稿: 14915 参加年月日: 06/09/02 最新の投稿Daniel Breitner:
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)
This is a class loader issue. You cannot create the instance in the portlet consuming the service and pass it to the portlet providing the service.
In the portlet providing the service, edit the TestServiceImpl class and make a "Test createTest(long someValue, long anotherValue);" method that invokes the create process and returns the instance. Portlet consuming the service would use this method.