Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Daniel Breitner
Can`t Store Liferay Service Entity ´with composite primary key
7. Januar 2012 13:40
Antwort

Daniel Breitner

Rang: Junior Member

Nachrichten: 94

Eintrittsdatum: 16. Juli 2008

Neue Beiträge

Hi you all !

Quick question:

I defined a Service Entity like this:

1<entity name="Test" local-service="true" remote-service="false">
2        <column name="part1" type="long" primary="true" />
3        <column name="part2" type="long" primary="true" />
4        <column name="part3" type="long" />
5    </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.

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


But whenever I do this I get the following exception:

121:26:12,708 ERROR [ClassLoaderProxy:70] java.lang.IllegalArgumentException: argument type mismatch
2java.lang.IllegalArgumentException: argument type mismatch
3    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
4    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
5    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
6    at java.lang.reflect.Method.invoke(Method.java:597)
7    at com.liferay.portal.kernel.util.ClassLoaderProxy._invoke(ClassLoaderProxy.java:246)
Alexey Kakunin
RE: Can`t Store Liferay Service Entity ´with composite primary key
1. Februar 2013 04:12
Antwort

Alexey Kakunin

Rang: Expert

Nachrichten: 451

Eintrittsdatum: 7. Juli 2008

Neue 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
Joaquin Cabal
RE: Can`t Store Liferay Service Entity ´with composite primary key
18. März 2012 17:01
Antwort

Joaquin Cabal

Rang: Junior Member

Nachrichten: 51

Eintrittsdatum: 7. September 2009

Neue Beiträge

Hi Daniel, What Liferay version are you using?
Harish Kumar
RE: Can`t Store Liferay Service Entity ´with composite primary key
8. Mai 2012 03:59
Antwort

Harish Kumar

Rang: Expert

Nachrichten: 355

Eintrittsdatum: 31. Juli 2010

Neue 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.
David H Nebinger
RE: Can`t Store Liferay Service Entity ´with composite primary key
8. Mai 2012 05:45
Antwort

David H Nebinger

Community Moderator

Rang: Liferay Legend

Nachrichten: 8603

Eintrittsdatum: 1. September 2006

Neue Beiträge

Daniel Breitner:
1TestPK testpk= new TestPK(someValue, anotherValue);
2TestLocalServiceUtil.createTest(testpk)


But whenever I do this I get the following exception:

121:26:12,708 ERROR [ClassLoaderProxy:70] java.lang.IllegalArgumentException: argument type mismatch
2java.lang.IllegalArgumentException: argument type mismatch
3    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
4    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
5    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
6    at java.lang.reflect.Method.invoke(Method.java:597)
7    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.