论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
sheela mk
One to many Relationship using Service builder
2012年5月28日 下午11:13
答复

sheela mk

等级: Regular Member

帖子: 111

加入日期: 2012年2月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年5月28日 下午11:23
答复

sheela mk

等级: Regular Member

帖子: 111

加入日期: 2012年2月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年5月28日 下午11:43
答复

sheela mk

等级: Regular Member

帖子: 111

加入日期: 2012年2月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年5月28日 下午11: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年5月29日 上午2:12
答复

sheela mk

等级: Regular Member

帖子: 111

加入日期: 2012年2月16日

最近的帖子

Hey,,Can U eloborate ..what you said...
sheela mk
RE: One to many Relationship using Service builder
2012年5月29日 上午4:42
答复

sheela mk

等级: Regular Member

帖子: 111

加入日期: 2012年2月16日

最近的帖子

Hai..Thanks for reply..I got to knw..how to achieve it..
Juan Gonzalez
RE: One to many Relationship using Service builder
2012年5月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年1月31日 上午9:11
答复

Michele Zanarotti

等级: Junior Member

帖子: 93

加入日期: 2012年2月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.