I'm a little late to this party, but here is the approach I'd take:
1. Use a batch size of N (in your case, this is 500, but it is really
DB-specific as to what can be handled with an IN clause).
2. Read in N (or whatever is remaining) records from your data file and
call your inserter method wit
This answer is probably way off topic for this group as it's not really
Cayenne related. But I want to give some closure to the solution so that
anyone else who ends up reading this can see the totality of the problem
and solution.
My original through was, I don't have to test for uniqueness becau
Would be nice if Cayenne could pinpoint the problematic record, but I think
that will depend on what error info the database provides.
Thinking of a strategy to get speed and correctness, how about an
optimistic strategy:
Process a batch of 500 records and if commit fails only then process that
b
That's a database error, not an ORM thing. And it's database specific. And
all the database gives you is the error string. So you HAVE to parse it if
that's what you want. The less hacky approach would be to detect the
prevent the duplicate key error upfront with custom logic.
On Fri, Sep 28, 2018
Yeah, that's pretty much what I ended up doing. Even reading the file line
by line and doing an insert after each object is created only made the run
time go to 4 minutes and I can live with that. What I really wanted to do
was find a way to recover from a larger commit. It seems that's not really
Commit the ObjectContext after each object/row and rollback the
ObjectContext on failure.
On Thu, Sep 27, 2018 at 3:57 PM Tony Giaccone wrote:
> So the question isn't as much about who to manage the transaction. It's
> more about how to recover and eliminate the offending object so that the
> co
So the question isn't as much about who to manage the transaction. It's
more about how to recover and eliminate the offending object so that the
commit can be made again.
On Thu, Sep 27, 2018 at 3:52 PM John Huss wrote:
> I'd just wrap the whole thing in a database transaction. Then commit your
I'd just wrap the whole thing in a database transaction. Then commit your
ObjectContexts as often as you want to, but the real DB commit won't happen
until the end.
TransactionManager transactionManager = CayenneRuntime.*getThreadInjector*
().getInstance(TransactionManager.*class*);
transactionMa
As far as Cayenne is concerned, javax.sql.DataSource is pluggable.
Cayenne provides one to you by default, but with the help of
DataSourceFactory in the Modeler (or even directly via API) you can
set your own DataSource with custom behavior. The simplest thing would
be to use a non-pooling
Hi Andrus,
I was wandering about my project and I can try to change the structure of
the code
but is it possible to close the connection and reopen it when I need it
inside the same java project? It means that I can get the data from mysql,
close the connection, compute what I need and reopen t
I understand, but which are the option in my.cnf that I should change? are
there any specific entries that I need to enable or disable?
thanks
Marco
On Jan 13, 2008 10:32 AM, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
> At this point it is hard to recommend anything specific with no access
> to y
At this point it is hard to recommend anything specific with no access
to your environment... Now that the client side is setup to handle
connection timeouts, you may have to start digging on the server side,
tweaking appropriate MySQL options (e.g. those in my.cnf).
Andrus
On Jan 12, 200
Hi Andrus,
I have created the new url adding what u have suggested me...
but I get again the same error:
org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2.3 May 6 2007] Commit
Exception
at org.objectstyle.cayenne.access.DataContext.flushToParent(
DataContext.java:1290)
at org
To make it valid XML you will need to replace "&" with "&" (or use
CayenneModeler that will do it for you).
Andrus
On Jan 11, 2008, at 12:02 PM, marco turchi wrote:
I have added the string that u send me,
value="jdbc:mysql://enm-nc-srv1/subsumer?
connectTimeout=0&autoReconnect=true"/>
I have added the string that u send me,
but I get:
java.lang.ExceptionInInitializerError
at com.translation.alg.TranslationNews.run(TranslationNews.java:33)
at com.translation.alg.TranslationNews.main(TranslationNews.java:21)
Caused by: org.objectstyle.cayenne.ConfigurationExcep
Thanks...I'm going to try...
Marco
On Jan 11, 2008 9:39 AM, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
> This is still a connection timeout issue. I dug up some of my own
> production configurations developed to address a similar issue. Here
> is another URL parameter you may try - "connectTimeou
This is still a connection timeout issue. I dug up some of my own
production configurations developed to address a similar issue. Here
is another URL parameter you may try - "connectTimeout". E.g.:
jdbc:mysql://server/database?connectTimeout=0&autoReconnect=true
Andrus
On Jan 11, 2008, a
Hi Andrus,
no good news...
I have run the software using the changes that u have suggested me, but I
get:
10 Jan 2008 23:19:30,036 - ERROR main com.translation.alg.TranslationNews -
Fatal Error:
org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2.3 May 6 2007] Commit
Exception
at org.ob
sorry about that... :-)
Thanks
Marco
On Jan 10, 2008 12:47 PM, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
> Ah cool. I thought I was going crazy :-)
>
> Andrus
>
> On Jan 10, 2008, at 2:37 PM, marco turchi wrote:
>
> > Hi Andrus,
> > sorry you are right I have added the autoReconnect to the wrong
Ah cool. I thought I was going crazy :-)
Andrus
On Jan 10, 2008, at 2:37 PM, marco turchi wrote:
Hi Andrus,
sorry you are right I have added the autoReconnect to the wrong
place...
now the software is started, I'll see what happens at the end...
thanks
Marco
On Jan 10, 2008 11:01 AM, marco
Hi Andrus,
sorry you are right I have added the autoReconnect to the wrong place...
now the software is started, I'll see what happens at the end...
thanks
Marco
On Jan 10, 2008 11:01 AM, marco turchi <[EMAIL PROTECTED]> wrote:
>
>
> value="jdbc:mysql://enm-nc-srv1/subsumer?autoReconne
thanks
Marco
On Jan 10, 2008 10:51 AM, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
>
>
>
> On Jan 10, 2008, at 12:33 PM, marco turchi wrote:
>
> >>> DataSource load failed - Can not load JDBC driver named
> >>> 'com.mysql.jdbc.Driver
> >>> ?autoReconnect=true': com.mys
On Jan 10, 2008, at 12:33 PM, marco turchi wrote:
DataSource load failed - Can not load JDBC driver named
'com.mysql.jdbc.Driver
?autoReconnect=true': com.mysql.jdbc.Driver?autoReconnect=true
But this is what generates an error... so somehow the driver name
seems messed up. Could you po
Sorry Andrus
I have this line:
inside the drive file but this does not work...
Thanks
Marco
On Jan 10, 2008 8:39 AM, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
> > maybe I have added it to the wrong place...
>
>
> Most likely... "autoReconnect=true" should be appended to the URL, not
> t
maybe I have added it to the wrong place...
Most likely... "autoReconnect=true" should be appended to the URL, not
the driver name.
Andrus
On Jan 10, 2008, at 4:38 AM, marco turchi wrote:
Hi Andrus,
I have added the jdbc:mysql://localhost/test?autoReconnect=true
string to
file.driver
Hi Andrus,
I have added the jdbc:mysql://localhost/test?autoReconnect=true string to
file.driver.xml file into my cayenne model, but I get this error:
org.objectstyle.cayenne.ConfigurationException: [v.1.2.3 May 6 2007] Error
during Configuration initialization. [v.1.2.3 May 6 2007] Load failures.
Hi Marco,
I think what you need is a reconnect parameter in your MySQL URL. E.g.:
jdbc:mysql://localhost/test?autoReconnect=true
Andrus
On Jan 8, 2008, at 8:02 PM, marco turchi wrote:
Dear experts,
I'm running a java software that gets some data from the DB,
computes them
and the write
27 matches
Mail list logo