フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
sheela mk
One to many Relationship using Service builder
2012/05/28 23:13
答え

sheela mk

ランク: Regular Member

投稿: 111

参加年月日: 2012/02/16

最近の投稿

hai..Everbody,

Pls chk my program,Let me know whr i'm going wrong..

And also..These use of finder tags,from which what method is generated and where it is generated????


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.0.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_0_0.dtd">
<service-builder package-path="com.test">
<author>sourceone</author>
<namespace>A</namespace>
<entity name="PRUser" local-service="true" remote-service="false">
<column name="prUserId" type="long" primary="true" />
<column name="firstName" type="String" />
<column name="lastName" type="String" />

<column name="address1" type="String" />
<column name="address2" type="String" />
<column name="city" type="String" />
<column name="state" type="String" />
<column name="postalCode" type="String" />
<column name="country" type="String" />
<column name="phoneNumber" type="String" />
<column name="email" type="String" />
<column name="birthDate" type="Date" />
<column name="male" type="boolean" />
<column name="userId" type="long" />
<column name="companyId" type="long" />
<column name="groupId" type="long" />

// I guess it should generate getuserRegistrations() in PRUser Model class....But..after doing service service builder
i'm not getting that method,,???

<column name="userRegistrations" type="Collection" entity="PRRegistration"
mapping-key="prUserId" />



<order by="asc">
<order-column name="lastName" case-sensitive="false" />
</order>

What are use of these tags,,pls gve me idea..name of the method generated on passing what parameter..and returns Collection of What??


<finder name="G_LN" return-type="Collection">
<finder-column name="groupId" />
<finder-column name="lastName" />
</finder>
<finder name="G_E" return-type="Collection">
<finder-column name="groupId" />
<finder-column name="email" />
</finder>
<finder name="G_U" return-type="Collection">
<finder-column name="groupId" />
<finder-column name="userId" />

</finder>



</entity>


<entity name="PRRegistration" local-service="true"
remote-service="false">
<column name="registrationId" type="long" primary="true" />
<column name="prUserId" type="long" />
<column name="datePurchased" type="Date" />
<column name="howHear" type="String" />
<column name="wherePurchased" type="String" />
<column name="serialNumber" type="String" />
<column name="productId" type="long" />
<column name="companyId" type="long" />
<column name="groupId" type="long" />



<finder name="GroupId" return-type="Collection">
<finder-column name="groupId" />
</finder>
<finder name="G_RU" return-type="Collection">
<finder-column name="groupId" />
<finder-column name="prUserId" />
</finder>
<finder name="G_DP" return-type="Collection">
<finder-column name="groupId" />
<finder-column name="datePurchased" />
</finder>
<finder name="G_SN" return-type="Collection">
<finder-column name="groupId" />
<finder-column name="serialNumber" />
</finder>

</entity>




</service-builder>
sheela mk
RE: One to many Relationship using Service builder
2012/05/28 23:23
答え

sheela mk

ランク: Regular Member

投稿: 111

参加年月日: 2012/02/16

最近の投稿

K..I got to know finder tags will generate methods in EntityPersistence class...ie a interface..

But I didnt get to know about..one to many relationship ..??Pls let me clear...
sheela mk
RE: One to many Relationship using Service builder
2012/05/28 23:43
答え

sheela mk

ランク: Regular Member

投稿: 111

参加年月日: 2012/02/16

最近の投稿

hai..I got to know..that method also generated in EntityPersistence interface..

Its impl is in EntityPersistenceImpl class...But How to get that method from persistence to my portlet class..I mean Layering???
Subhash Shah
RE: One to many Relationship using Service builder
2012/05/28 23:55
答え

Subhash Shah

ランク: Junior Member

投稿: 77

参加年月日: 2011/11/29

最近の投稿

sheela mk:
But How to get that method from persistence to my portlet class..I mean Layering???


You should use <Entity-name>LocalServiceUtil class to use/call the method from your portlet.
sheela mk
RE: One to many Relationship using Service builder
2012/05/29 2:12
答え

sheela mk

ランク: Regular Member

投稿: 111

参加年月日: 2012/02/16

最近の投稿

Hey,,Can U eloborate ..what you said...
sheela mk
RE: One to many Relationship using Service builder
2012/05/29 4:42
答え

sheela mk

ランク: Regular Member

投稿: 111

参加年月日: 2012/02/16

最近の投稿

Hai..Thanks for reply..I got to knw..how to achieve it..
Juan Gonzalez
RE: One to many Relationship using Service builder
2012/05/29 10:26
答え

Juan Gonzalez

LIFERAY STAFF

ランク: Liferay Legend

投稿: 2947

参加年月日: 2008/10/28

最近の投稿

sheela mk:
Hai..Thanks for reply..I got to knw..how to achieve it..


Please can you tell how did you solve it, so others can read the correct answer....

Thanks!
Michele Zanarotti
RE: One to many Relationship using Service builder
2013/01/31 9:11
答え

Michele Zanarotti

ランク: Junior Member

投稿: 93

参加年月日: 2012/02/20

最近の投稿

'Service Builder generates a getRegistrations() method in PRUser objects...'

That's exactly what the book 'Liferay In Action' is saying at page 87 (2012 edition), after showing how to relate PRUser and PRRegistration.

Precisely the book had to say 'getUserRegistrations()', but i thought it as a typo. In any case i downloaded the sources of the book examples and
even there this method does not exist.

Furthermore the book does not use this method, so I can't know how to use it or if I'm doing something wrong.

Can we have some clarifying explanation from the liferay team ? I browsed forums and tutorials for a week without any solution, and only more questions raised emoticon

I'm using Liferay 6.1 GA1.