フォーラム

ホーム » Liferay Portal » česky a slovensky

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Daniel Breitner
Can`t Store Liferay Service Entity ´with composite primary key
2012/01/07 13:40
答え

Daniel Breitner

ランク: Junior Member

投稿: 94

参加年月日: 2008/07/16

最近の投稿

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
2013/02/01 4:12
答え

Alexey Kakunin

ランク: Expert

投稿: 470

参加年月日: 2008/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
Joaquin Cabal
RE: Can`t Store Liferay Service Entity ´with composite primary key
2012/03/18 17:01
答え

Joaquin Cabal

ランク: Junior Member

投稿: 53

参加年月日: 2009/09/07

最近の投稿

Hi Daniel, What Liferay version are you using?
Harish Kumar
RE: Can`t Store Liferay Service Entity ´with composite primary key
2012/05/08 3:59
答え

Harish Kumar

ランク: Expert

投稿: 386

参加年月日: 2010/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.
David H Nebinger
RE: Can`t Store Liferay Service Entity ´with composite primary key
2012/05/08 5:45
答え

David H Nebinger

Community Moderator

ランク: Liferay Legend

投稿: 8943

参加年月日: 2006/09/01

最近の投稿

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.