Bug 395 : On save @OneToOne does not cascade parent IDs to child node
Priority 
High
Reported Version 
 
Logged By 
Byszo
Status 
Fixed
Fixed Version 
github
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
24/04/2012
Updated 
24/04/2012
Type 
Bug
 
Attachments 
No attachments

For some reason @OneToOne persists child with parent's node as NULL

@Entity
public class Customer {
@Id Integer id;
String name;
@OneToOne(cascade=CascadeType.ALL, mappedBy="customer") Order order;
...
}

@Entity
@Table(name="orders")
public class Order {
@Id Integer id;
String name;
@OneToOne Customer customer;
...
}

main:
EbeanServer server = EbeanServerFactory.create(config);
Customer c = new Customer();
c.setName("CName");

Order o = new Order();
o.setName("OName");

c.setOrder(o);

server.save(c);

in result Order is persisted with customer_id as null

 
woResponse

Upload a file