Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
sheela mk
One to many Relationship using Service builder
28 maggio 2012 23.13
Risposta

sheela mk

Punteggio: Regular Member

Messaggi: 111

Data di Iscrizione: 16 febbraio 2012

Messaggi recenti

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 maggio 2012 23.23
Risposta

sheela mk

Punteggio: Regular Member

Messaggi: 111

Data di Iscrizione: 16 febbraio 2012

Messaggi recenti

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 maggio 2012 23.43
Risposta

sheela mk

Punteggio: Regular Member

Messaggi: 111

Data di Iscrizione: 16 febbraio 2012

Messaggi recenti

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 maggio 2012 23.55
Risposta

Subhash Shah

Punteggio: Junior Member

Messaggi: 77

Data di Iscrizione: 29 novembre 2011

Messaggi recenti

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 maggio 2012 2.12
Risposta

sheela mk

Punteggio: Regular Member

Messaggi: 111

Data di Iscrizione: 16 febbraio 2012

Messaggi recenti

Hey,,Can U eloborate ..what you said...
sheela mk
RE: One to many Relationship using Service builder
29 maggio 2012 4.42
Risposta

sheela mk

Punteggio: Regular Member

Messaggi: 111

Data di Iscrizione: 16 febbraio 2012

Messaggi recenti

Hai..Thanks for reply..I got to knw..how to achieve it..
Juan Gonzalez
RE: One to many Relationship using Service builder
29 maggio 2012 10.26
Risposta

Juan Gonzalez

LIFERAY STAFF

Punteggio: Liferay Legend

Messaggi: 1984

Data di Iscrizione: 28 ottobre 2008

Messaggi recenti

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 gennaio 2013 9.11
Risposta

Michele Zanarotti

Punteggio: Junior Member

Messaggi: 84

Data di Iscrizione: 20 febbraio 2012

Messaggi recenti

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