Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
sheela mk
One to many Relationship using Service builder
28. Mai 2012 23:13
Antwort

sheela mk

Rang: Regular Member

Nachrichten: 112

Eintrittsdatum: 16. Februar 2012

Neue Beiträge

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
28. Mai 2012 23:23
Antwort

sheela mk

Rang: Regular Member

Nachrichten: 112

Eintrittsdatum: 16. Februar 2012

Neue Beiträge

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
28. Mai 2012 23:43
Antwort

sheela mk

Rang: Regular Member

Nachrichten: 112

Eintrittsdatum: 16. Februar 2012

Neue Beiträge

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
28. Mai 2012 23:55
Antwort

Subhash Shah

Rang: Junior Member

Nachrichten: 77

Eintrittsdatum: 29. November 2011

Neue Beiträge

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
29. Mai 2012 02:12
Antwort

sheela mk

Rang: Regular Member

Nachrichten: 112

Eintrittsdatum: 16. Februar 2012

Neue Beiträge

Hey,,Can U eloborate ..what you said...
sheela mk
RE: One to many Relationship using Service builder
29. Mai 2012 04:42
Antwort

sheela mk

Rang: Regular Member

Nachrichten: 112

Eintrittsdatum: 16. Februar 2012

Neue Beiträge

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

Juan Gonzalez

LIFERAY STAFF

Rang: Liferay Legend

Nachrichten: 1872

Eintrittsdatum: 28. Oktober 2008

Neue Beiträge

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
31. Januar 2013 09:11
Antwort

Michele Zanarotti

Rang: Junior Member

Nachrichten: 74

Eintrittsdatum: 20. Februar 2012

Neue Beiträge

'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.