[hibernate-issues] [Hibernate-JIRA] Closed: (HBX-560) Support of Cacase Insert when creating mapping files

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Thu Sep 14 09:57:24 EDT 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-560?page=all ]
     
Max Rydahl Andersen closed HBX-560:
-----------------------------------

    Resolution: Rejected

use forum.hibernate.org for usage questions.

> Support of Cacase Insert when creating mapping files
> ----------------------------------------------------
>
>          Key: HBX-560
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-560
>      Project: Hibernate Tools
>         Type: New Feature

>   Components: reverse-engineer
>  Environment: Hibernate Tools Does Not Support Cascade Inserts/Updates
>     Reporter: tony anecito
>     Priority: Blocker

>
>
> Recently on the Hibernate forum i gave the following example which in summary is a parent/child relationship where there can be many children. It was mentioned that cascading was not currently supported. I am suspecting it is not a Hibernate issue but a missing enhancement for the tools so that the mapping files are generated with cascade support for inserts.
> For example we have an AutoMaker class generated by Hibernate Tools 
> public class AutoMaker { 
> private Set Car cars; 
> AutoMaker() {} 
> public void setCars(Car vo) { 
> car = vo; 
> } 
> public Car getCars() { 
> return car; 
> } 
> } 
> public class Car { 
> private long serialNumber; 
> private String color; 
> public Car() {} 
> public setSerialNumber(long id) { 
> serialNumber = id; 
> } 
> public long getSerialNumber() { 
> return serialNumber; 
> } 
> public void setColor(String val) { 
> color = val; 
> } 
> public String getColor() { 
> return color; 
> } 
> } 
> So. I have several questions: 
> 1. Assuming Hibernate Tools maps the serialNumber value to the primary column in the table Car does Hibernate Tools tie the Car instance such that if I populate the serialNumber attribute in an instance of Car and add that to an instance of HashSet and that instance is passed to the setCar in an instance the AutoMaker class that an entry in the Car table will be inserted or updated when an instance of AutoMaker is passed to a Hibernate seesion and committed? 
> so: 
> AutoMaker autoMaker = new AutoMaker(); 
> Car car = new Car(); 
> car.setSerialNumber(10); 
> HashSet cars = new HashSet(); 
> cars.add(car); 
> autoMaker.setCars(cars); 
> session.saveOrUpdate(cars); 
> session.flush(); 
> session.connection.commit(); 
> So this should work because of the mapping generated by the tools or is there some key I need to generate for the set so when I add the cars to the HashSet I provide some sort of key in addition to the car object? 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list