I have two tables which has the following structure

@hibernate.class table = "Person"
class Person{

    private String name
    private Car car

    @hibernate.id column = "NAME" generator-class = "native"
    @hibernate.generator-param name = "sequence" value = "SEQ_1"
    public String getName(){return name;}


    public void setName(String name){this.name=name;}

    @hibernate.many-to-one column="MODEL_ID" class="CAR" cascade="all"
    public Car getCar(){return car;}

    public void setCar(Car car){this.car=car;}
}

@hibernate.class table = "CAR"
class Car{

    private String modelID; 
    private String carName;


    @hibernate.id column = "MODEL_ID" generator-class = "assigned"
    public String getModelID(){return modelID}

    etc.... 
}

but when i try to delete or save on the Person class it hiberbate throws this exception

this is the complete exception code: org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient

Can you give me any help on this?

0

There are 0 best solutions below