...
Entity Car - Das Entity Car wird um das Attribut carManufacturer vom Typ CarManufacturer erweitert.
Code Block language java theme Confluence @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.
Code Block language java theme Confluence @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; }
...