Foreign key error if using GenerationType.AUTO or GenerationType.TABLE

2009-06-22 Thread wang yu
Hello, If I use GenerationType.AUTO or GenerationType.TABLE for PK field and let OpenJPA persist some entities cascade , in some cases, OpenJPA will try to persist child entity before the father entity. How to resolve this issue? I must use GenerationType.AUTO for oracle because it doesn't

prepared statement pooling MySQL

2009-06-22 Thread Georgi Naplatanov
Hello list I use OpenJPA with Apache DBCP in Java SE environment. My problem is the performance when prepared statement pooling is enabled in DBCP - it is the same as when statement pooling is disabled. My question is - why prepared statement pooling does not increase performance on MySQL

Why is slice module not depended on persistence-jdbc module

2009-06-22 Thread ashish paliwal
Hi, I wanted to know that why is slice module not depended on openjpa-persistence-jdbc module. I was trying to figure out the reason but could not get to anything conclusive. I felt that both persistence and persistence-jdbc module are central to design of openjpa and since there is dependency on

Re: Why is slice module not depended on persistence-jdbc module

2009-06-22 Thread Donald Woods
For runtime, Slice only needs access to the jdbc, kernel, and lib jars as it is a BrokerFactory/JDBCProvider. It provides its own ProductDerivation in - src/main/java/org/apache/openjpa/slice/ProductDerivation.java For junit tests, it should only need to include openjpa-persistence for

Problem with @TableGenerator [OpenJPA 1.2.2]

2009-06-22 Thread Michael Simons
Hello, Here's my annotation: @TableGenerator(name = pkGenSessionConfig, table = jdo_keygen, pkColumnName = table_name, valueColumnName = last_used_id, pkColumnValue = session_config, allocationSize = 10) @Id @GeneratedValue(strategy=GenerationType.TABLE,

Re: Why is slice module not depended on persistence-jdbc module

2009-06-22 Thread Michael Dick
I suspect that one of Pinaki's design goals with Slice was to make it persistence personality agnostic. So one could use it with a JDO personality as well as a JPA personality (KODO provides both, OpenJPA provides the latter). Slice uses both openjpa-persistence and openjpa-persistence-jdbc for

Re: prepared statement pooling MySQL

2009-06-22 Thread Michael Dick
Hi Georgi, It's hard to say anything definitive without seeing the prepared statements that are being pooled. We generate slightly different SQL for different databases, and depending on your app it might not lend itself well to pooling with MySQL. Could you enable openjpa SQL tracing to see

Re: Foreign key error if using GenerationType.AUTO or GenerationType.TABLE

2009-06-22 Thread Michael Dick
Hi, Which version of OpenJPA are you using? OpenJPA does not assume there are any constraints in the database unless you add the @ForeignKey annotation or configure OpenJPA to read constraints from the database. As a result we can sometimes do inserts out of order.. I tried to make this less

Re: Problem with @TableGenerator [OpenJPA 1.2.2]

2009-06-22 Thread Fay Wang
Hi,     I used your annotation and my test case runs fine.     Given your pkColumnName = table_name, openjpa internally makes this column name valid for a given database.  This code is in ValueTableJDBCSeq:     protected Column addPrimaryKeyColumn(Table table) {     DBDictionary dict =

Re: prepared statement pooling MySQL

2009-06-22 Thread Georgi Naplatanov
Hi Michael here is the log, look at the end of file http://os.oles.biz/opencms/jpa-driver/tmp/jpa-trace.log.tar.gz The application use traditional join syntax property name=openjpa.jdbc.DBDictionary value=JoinSyntax=traditional, SupportsUniqueConstraints=false/ Best regards Georgi Michael

Re: Best practice to avoid duplicates on @Column(unique=true)

2009-06-22 Thread Jeremy Bauer
David Milosz, Based on the information provided, I do not think Bean Validation would provide a good solution for this problem. Used within the context of JPA, bean validation gets called when various lifecycle events occur; pre-persist, pre-remove, pre-update. In order to create a custom

Re: Problem with @TableGenerator [OpenJPA 1.2.2]

2009-06-22 Thread Michael Simons
Hi Fay Wang, thanks for your reply. As you probably already guessed beacuse of the name jdo_keygen, we are porting an application that was based on JDO to JPA. So the table already exists and we must not generate it. As the table already exists with a column table_name this name is valid as a

Re: Foreign key error if using GenerationType.AUTO or GenerationType.TABLE

2009-06-22 Thread Miłosz Tylenda
Hi! Also, you will find child father ideas in thread [1]. The FAQ [2] mentions it too. As for IDENTITY with Oracle, you could try the emulation feature [3]. It emulates auto-increment columns by using triggers. Regards, Milosz [1]

Re: openjpa.LockManager

2009-06-22 Thread Daryl Stultz
2009/6/10 Daryl Stultz da...@6degrees.com Yup, I forgot the @ForeignKey annotation. I have added it and reverted to my cascade/not deferrable setting and it seems to be working. Thanks! Well, the @ForeignKey did take care of the ordering of the SQL, but I deployed it to a test server and it

Re: Best practice to avoid duplicates on @Column(unique=true)

2009-06-22 Thread Jeremy Bauer
Hi Milosz, Great observation questions. The sentence you refer to means that you can directly invoke a JSR-303 validator at any time from the application. ex: javax.validation.ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); javax.validation.Validator

Re: Problem with @TableGenerator [OpenJPA 1.2.2]

2009-06-22 Thread Fay Wang
As a workaround so that you can proceed, could you alter your jdo_keygen table by changing the column table_name to table_name0, meanwhile you might want to open a jira issue for this problem. Regards, Fay - Original Message From: Michael Simons michael.sim...@optitool.de To:

Re: Foreign key error if using GenerationType.AUTO or GenerationType.TABLE

2009-06-22 Thread wang yu
hello mike, Thank you for your prompt and detailed response. I use OpenJPA 1.2.1. I have added foolowing into persistence.xml property name=openjpa.jdbc.SynchronizeMappings value=buildSchema(ForeignKeys=true) / property