app/repository/DestinationTravellerTypeRepository.java
Optional<Integer> insertDestinationTravellerType(TravellerType travellerType, Integer destinationId) {
        Optional<Integer> integerOptional = travellerTypeRepository.getTravellerTypeId(travellerType.getTravellerTypeName());
        Integer idOpt = null;
        if (integerOptional.isPresent()) {
            idOpt = integerOptional.get();
        }
        Integer travellerId = idOpt;
        if (idOpt == null) {
            Optional<Integer> travellerIdOpt = travellerTypeRepository.insert(travellerType);
            if (travellerIdOpt.isPresent()) {
                travellerId = travellerIdOpt.get();
            }
        }
        Transaction txn = ebeanServer.beginTransaction();
        String qry = "INSERT into destination_traveller_type (destination_id, traveller_type_id) " +
                "VALUES (?, ?)";
        try {
            SqlUpdate query = Ebean.createSqlUpdate(qry);
            query.setParameter(1, destinationId);
            query.setParameter(2, travellerId);
            query.execute();
            txn.commit();
        } finally {
            txn.end();
        }
        return Optional.of(travellerId);
    }
/**
     * Inserts a nationality into the profile passport country linking table
     * @param travellerType The nationality to add
     * @return
     */
Inserts a nationality into the profile passport country linking table
@param travellerType The nationality to add
@return
Inserts a nationality into the profile passport country linking table @param travellerType The nationality to add @return
Optional<Integer> insertDestinationTravellerType(TravellerType travellerType, Integer destinationId) {
        Optional<Integer> integerOptional = travellerTypeRepository.getTravellerTypeId(travellerType.getTravellerTypeName());
        Integer idOpt = null;
        if (integerOptional.isPresent()) {
            idOpt = integerOptional.get();
        }
        Integer travellerId = idOpt;
        if (idOpt == null) {
            Optional<Integer> travellerIdOpt = travellerTypeRepository.insert(travellerType);
            if (travellerIdOpt.isPresent()) {
                travellerId = travellerIdOpt.get();
            }
        }
        Transaction txn = ebeanServer.beginTransaction();
        String qry = "INSERT into destination_traveller_type (destination_id, traveller_type_id) " +
                "VALUES (?, ?)";
        try {
            SqlUpdate query = Ebean.createSqlUpdate(qry);
            query.setParameter(1, destinationId);
            query.setParameter(2, travellerId);
            query.execute();
            txn.commit();
        } finally {
            txn.end();
        }
        return Optional.of(travellerId);
    }
Optional < Integer > insertDestinationTravellerType ( TravellerType travellerType , Integer destinationId ) { Optional < Integer > integerOptional = travellerTypeRepository . getTravellerTypeId ( travellerType . getTravellerTypeName ( ) ) ; Integer idOpt = null ; if ( integerOptional . isPresent ( ) ) { idOpt = integerOptional . get ( ) ; } Integer travellerId = idOpt ; if ( idOpt == null ) { Optional < Integer > travellerIdOpt = travellerTypeRepository . insert ( travellerType ) ; if ( travellerIdOpt . isPresent ( ) ) { travellerId = travellerIdOpt . get ( ) ; } } Transaction txn = ebeanServer . beginTransaction ( ) ; String qry = "INSERT into destination_traveller_type (destination_id, traveller_type_id) " + "VALUES (?, ?)" ; try { SqlUpdate query = Ebean . createSqlUpdate ( qry ) ; query . setParameter ( 1 , destinationId ) ; query . setParameter ( 2 , travellerId ) ; query . execute ( ) ; txn . commit ( ) ; } finally { txn . end ( ) ; } return Optional . of ( travellerId ) ; }
Inserts a nationality into the profile passport country linking table
 @param travellerType The nationality to add
 @return
Inserts a nationality into the profile passport country linking table @param travellerType The nationality to add @return