openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Uden <ude...@gmail.com>
Subject Question regarding cascade attribute
Date Thu, 08 May 2008 10:40:56 GMT

We expected that with a @OneToMany(cascade = cascadeType.ALL) relation, we
only had to persist the object that 'owns' the relation (Order in the
example below) to save the objects on both sides of the relation.

We noticed however that from all objects in the Set, only one was persisted.

Is this a bug or are we doing something wrong?

thanks,
Uden

Example 1:
==========
@Entity
Class Order {

@OneToMany(cascade = cascadeType.ALL)
Set<OrderLine> orderlines;

...
}

@Entity
Class OrderLine { ... }

This Class hierarchy results in three database tables: ORDER, ORDERLINE and
ORDER_ORDERLINE. When we create and persist an Order, add three OrderLines
and merge (update) the Order, only one OrderLine can be found in the
database.
We use OpenJPA 1.0.2 and Derby 10.3.2.1.

-- 
View this message in context: http://www.nabble.com/Question-regarding-cascade-attribute-tp17124662p17124662.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message