openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Das, Aditi" <>
Subject JPQL delete fetches the record first before deleting. Why?
Date Mon, 14 Apr 2008 21:33:06 GMT
I want to delete from table ORDER where order_id = 100, Also order table
should cascade delete it's child table.
But with the below statement, openJPA executes a select query for ORDER
and it's child table before executing the delete query. These extra sqls
are hit on performance. Am I missing out any configuration setting?
I am using openjpa-1.0.2 and mysql DB.
Query query = em.createNamedQuery("deleteCart");
query.setParameter("orderId", 100);
int ret = query.executeUpdate();
Below is the Order entity
        query="DELETE from ORDER ord where ord.orderId = :orderId")
@Table(name="ORDERS", schema="ormtest")
public class Order {
 @Column(name="ORDER_ID", updatable = false) // Well, no one should
update primary key
 @GeneratedValue(strategy =
 private int orderId;
 private int custId;
 private double totalPrice;
 private Date orderDate;
private String isFulFilled;
 private Customer customer;
 private int custBillingId;
 private Date lastUpdatedTime;
 // One order can have many Order detail
 private List<OrderDetail> orderDetailList;

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message