Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Entity Car - Das Entity Car wird um das Attribut carManufacturer vom Typ CarManufacturer erweitert.

    Image Removed


    Code Block
    languagejava
    themeConfluence
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "carManufacturer_id")
    public CarManufacturer getCarManufacturer()
    {
    	return this.carManufacturer;
    }
    
    public void setCarManufacturer(final CarManufacturer carManufacturer)
    {
    	this.carManufacturer = carManufacturer;
    }


  • Entity Automaker CarManufacturer - Durch die übernommene Einstellung Bidirectional wird gleichzeitig das Entity Automaker um CarManufacturer um eine Liste mit allen Carmodels cars erweitert.
    Image RemovedImage Added

    Code Block
    languagejava
    themeConfluence
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "carManufacturer")
    public List<Car> getCars()
    {
    	return this.cars;
    }
    
    public void setCars(final List<Car> cars)
    {
    	this.cars = cars;
    }
    
    public Car addCar(final Car car)
    {
    	this.getCars().add(car);
    	car.setCarManufacturer(this);
    	return car;
    }
    
    public Car removeCar(final Car car)
    {
    	this.getCars().remove(car);
    	car.setCarManufacturer(null);
    	return car;
    }


...