Re: sql ordering

2008-08-25 Thread Georgi Naplatanov
Hello, Pinaki. > Nope. Unique constraints can be placed by annotations/xml descriptors. But > the topological sorting algorithm that imposes an order on sql statements to > satisfy both database constraints and object-level operations do not > consider unique constraints. You are right, but i thi

Re: sql ordering

2008-08-25 Thread Pinaki Poddar
tions do not consider unique constraints. So if a transaction removes x1 and inserts x2 while x1 and x2 has the same value for a unique non-primary column then OpenJPA *does not* ensure that DELETE x1 will be issued before INSERT x2. -- View this message in context: http://n2.nabble.com/sql-

Re: sql ordering

2008-08-25 Thread Reece Garrett
That's great news; I did not think unique constraints had been fixed. Thank you for letting me know! -Reece >>> Georgi Naplatanov <[EMAIL PROTECTED]> 8/25/2008 1:40 PM >>> Hello, Reece, you are happy man. This problem seems solved. I tested it with OpenJPA 1.2.0. You have to declare you unique

Re: sql ordering

2008-08-25 Thread Georgi Naplatanov
Hello, Reece, you are happy man. This problem seems solved. I tested it with OpenJPA 1.2.0. You have to declare you unique constraint in the persistence class(es) something like: @Entity @Table(name="my_table_name", [EMAIL PROTECTED](columnNames={"my_field1_id", "my_field2_id"})) public class MyC

Re: sql ordering

2008-08-25 Thread Reece Garrett
Georgi, Perhaps I misunderstood your original post. My problem was related to the ordering of insert/delete/and update statements. For example, if in the same transaction I delete a row with a unique column value A and also insert a row with unique column value A OpenJPA will sometimes do the i

Re: sql ordering

2008-08-25 Thread Georgi Naplatanov
Hello, Reece. I switched on OpenJPA logging and in some situations OpenJPA try to insert 2 rows with the same values of constraint's fields which violates unique constraint. It occurs only when query's data cache is enabled (it is enabled by default). Is your problem stopping raise when you swit

Re: sql ordering

2008-08-25 Thread Reece Garrett
Hello, You may want to look at http://issues.apache.org/jira/browse/OPENJPA-235. I was having problems with OpenJPA violating foreign key constraints because of the order SQL statements ran. Later I found, as have you, that unique constraints are also violated. Foreign keys now seem to be worki

sql ordering

2008-08-24 Thread Georgi Naplatanov
Hello, everybody. Is there a way to be executed generated SQL statements in order in which application passes them to OpenJPA ? I tried "operation-order" implementation, but it reorders statements and violates unique constraints in the database despite they are declared in persistence classes, ev