Hi,

i am getting crazy. Hope someone can point me to the right spot. Suppose the 
following tables:

DB-Table: orders
--------
oid int
...


DB-Table: Adress
----------
oid int
order_oid



Now my classes:

@Entity
@Table(name = "orders")
public class Order {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "oid")
    int oid;

    @OneToMany(mappedBy = "order", fetch = FetchType.EAGER, cascade = 
CascadeType.ALL)
    List<DeliveryAddress> deliveryAddresses;
    ....
})

@Entity
public class DeliveryAddress extends Address {
     .... (Id and Table annotation from superclass. Id field is also "oid")

    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name="order_oid", referencedColumnName="oid")
    Order order;
}


Now when i persist my order table, everything is fine but the foreign key 
"order_oid" inside the address table is null. Same goes on for other mappings 
as well. Whats the problem here?

Thanks.

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Reply via email to