I have this relation between Travelers and Trips in Hibernate:
If I want to create a new trip for traveler 1, I visit the route /frontend/#/trip-creation/1 and here I have a form:
By accessing the $routeParams.id I can get the details for traveler 1 like firstName (= Marcel) , lastName and also traveler_id.
$scope.traveler = TravelerFactory.show({id: $routeParams.id});
That is an example for the Traveler object. It contains all the Trips a Traveler had made so far:
[{"traveler_id":1,"company_id":0,"account":false,"firstName":"Marcel","middleName":null,"lastName":"Schmitt","gender":null,"trips":[],"email":null}]
My question:
-
How can I relate my traveler 1 with the new created trip
[{"trip_id":2,"traveler":null,"currency":null,"rate":100,"description":"Flug","dateCreated":null}]
-
Is this a proper way of mapping the realtions?
Thank you!
Additional information // backend: Java, Hibernate 4.11, SpringMVC // frontend: AngularJS 1.4.3
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire