Foren
Can`t Store Liferay Service Entity ´with composite primary key
Daniel Breitner, geändert vor 12 Jahren.
Can`t Store Liferay Service Entity ´with composite primary key
Regular Member Beiträge: 105 Beitrittsdatum: 16.07.08 Neueste Beiträge
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)
Alexey Kakunin, geändert vor 12 Jahren.
RE: Can`t Store Liferay Service Entity ´with composite primary key
Liferay Master Beiträge: 621 Beitrittsdatum: 07.07.08 Neueste Beiträge
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
Joaquin Cabal, geändert vor 12 Jahren.
RE: Can`t Store Liferay Service Entity ´with composite primary key
Regular Member Beiträge: 106 Beitrittsdatum: 07.09.09 Neueste Beiträge
Hi Daniel, What Liferay version are you using?
Harish Kumar, geändert vor 11 Jahren.
RE: Can`t Store Liferay Service Entity ´with composite primary key
Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
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.
David H Nebinger, geändert vor 11 Jahren.
RE: Can`t Store Liferay Service Entity ´with composite primary key
Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste BeiträgeDaniel 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.