Foren

create an association class with service builder

kev ary, geändert vor 9 Jahren.

create an association class with service builder

New Member Beiträge: 23 Beitrittsdatum: 19.05.14 Neueste Beiträge
Hello,
I'm looking for doing something similar to this with service-builder!

is there any suggestions??
thumbnail
David H Nebinger, geändert vor 9 Jahren.

RE: create an association class with service builder

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Sure this is doable. Unfortunately your diagram is a UML diagram and not an entity diagram, so there's no mention of keys and how the three entities actually relate to each other.
kev ary, geändert vor 9 Jahren.

RE: create an association class with service builder

New Member Beiträge: 23 Beitrittsdatum: 19.05.14 Neueste Beiträge
I tried this implementation:
<entity name="Flight" local-service="true" remote-service="false">
<column name="flightId" type="long" primary="true" id-type="sequence" id-param="id_flight_sequence"></column>
<column name="flightNumber" type="long"></column>
<column name="departureTime" type="Date"></column>
<column name="flightDuration" type="long"></column>
<column name="FrequentFlyers" type="Collection" mapping-table="MileageCredit" entity="FrequentFlyer"></column>
</entity>

<entity name="FrequentFlyer" local-service="true" remote-service="false">
<column name="FrequentFlyerId" type="long" primary="true" id-type="sequence"
id-param="id_frequentFlyer_sequence"></column>
<column name="firstName" type="String"></column>
<column name="lastName" type="String"></column>
<column name="frequentFlayerNumber" type="String"></column>
<column name="Flights" type="Collection" mapping-table="MileageCredit"
entity="Flight"></column>
</entity>
baseMiles integer????
bonusMiles integer?????

But I don't know where to put those attributes (I mean baseMiles & bonusMiles)!!!
"And by the way The primary key of the "MileageCredit" table is the composite key of the other tables"
thumbnail
David H Nebinger, geändert vor 9 Jahren.

RE: create an association class with service builder

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
For me, I think this information (base miles and bonus miles) are part of the user flight information. So it's kind of like a join table with additional attributes...

<entity name="FlightFlyer" ...>
<column name="flightFlyerId" primary="true">

<column name="flightId" type="int" />
<column name="frequentFlyerId" type="int" />

<column name="baseMiles" type="int" />
<column name="bonusMiles" type="int" />

<finder name="FrequentFlyerId" return-type="Collection">
<finder-column name="frequentFlyerId" />
</finder>
<finder name="FlightId" return-type="Collection">
<finder-column name="flightId" />
</finder>
<finder name="FrequentFlyerFlightIds" return-type="Collection">
<finder-column name="frequentFlyerId" />
<finder-column name="flightId" />
</finder>
</entity>