Fórumok
Can`t Store Liferay Service Entity ´with composite primary key
Daniel Breitner, módosítva 12 év-val korábban
Can`t Store Liferay Service Entity ´with composite primary key
Regular Member Bejegyzések: 105 Csatlakozás dátuma: 2008.07.16. Legújabb bejegyzések
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, módosítva 12 év-val korábban
RE: Can`t Store Liferay Service Entity ´with composite primary key
Liferay Master Bejegyzések: 621 Csatlakozás dátuma: 2008.07.07. Legújabb bejegyzések
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, módosítva 12 év-val korábban
RE: Can`t Store Liferay Service Entity ´with composite primary key
Regular Member Bejegyzések: 106 Csatlakozás dátuma: 2009.09.07. Legújabb bejegyzések
Hi Daniel, What Liferay version are you using?
Harish Kumar, módosítva 11 év-val korábban
RE: Can`t Store Liferay Service Entity ´with composite primary key
Expert Bejegyzések: 483 Csatlakozás dátuma: 2010.07.31. Legújabb bejegyzések
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, módosítva 11 év-val korábban
RE: Can`t Store Liferay Service Entity ´with composite primary key
Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzésekDaniel 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.