openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikolas Everett" <nik9...@gmail.com>
Subject Re: Compiling
Date Sun, 04 May 2008 21:17:21 GMT
So, I've spent a few hours digging into adding support for INSERT RETURNING,
and I give up.  Here is why:

   1. The architecture used to generate SQL is all over the place.
   Sometimes SQL is generated in DBDictionary classes.  Sometimes it is
   generated in RowImpl and who knows where else.  This makes it very hard to
   customize generated SQL based on DB features.
   2. The same is true for processing the results of generated SQL.  Why
   isn't this all in the same place so its overridable on a DB by DB level?
   3. Public variables
   4. Protected variables
   5. Lack of generics in 1.5 projects (openjpa-persistence-jdbc)
   6. StringBuffer in non-threaded areas of 1.5 projects
   (openjpa-persistence-jdbc)
   7. A lot of strings seem to be regenerated over and over again.  I
   could be wrong, given 1.
   8. Lots of magic strings.  I expected this when generating SQL, but
   when throwing exceptions? throw new
   SQLException(_loc.get("update-failed-no-failed-obj",
   String.valueOf(count[i]), _batchedSql).getMessage());

Are there plans to fix any of this?


On Sat, May 3, 2008 at 12:50 PM, Nikolas Everett <nik9000@gmail.com> wrote:

> From http://www.postgresql.org/docs/8.3/static/sql-insert.html -
> The optional RETURNING clause causes INSERT to compute and return value(s)
> based on each row actually inserted. This is primarily useful for obtaining
> values that were supplied by defaults, such as a serial sequence number.
> However, any expression using the table's columns is allowed. The syntax of
> the RETURNING list is identical to that of the output list of SELECT.
>
> That should prevent the need for the SELECT CURVAL('seq') query after
> inserting a row.  It saves you one SQL statement per insert.  Technically
> its also useful for other things, but thats the biggest thing I can think
> of.
>
>
> On Sat, May 3, 2008 at 10:49 AM, Patrick Linskey <plinskey@gmail.com>
> wrote:
>
> > Hi,
> >
> > Inserts are handled by ClassMappings and their FieldMappings and
> > associated strategies.
> >
> > What does INSERT RETURNING do? Can you describe how you want to utilize
> > it from OpenJPA?
> >
> > -Patrick
> >
> >
> > On May 3, 2008, at 4:59 AM, Nikolas Everett wrote:
> >
> >  I'm pretty much lost in the source code.  I'm looking for the piece
> > > who's
> > > job it is to run inserts.  I'm specifically wondering whether it would
> > > be
> > > possible for OpenJPA to take advantage of Postgres's INSERT RETURNING
> > > clauses.
> > >
> > > On Fri, May 2, 2008 at 9:38 PM, Nikolas Everett <nik9000@gmail.com>
> > > wrote:
> > >
> > >  I guess I should have read more closely.  OpenJPA only compiles on
> > > > java
> > > > 1.5, not 1.6.  That is funky.
> > > >
> > > > Sorry to bother the list.
> > > >
> > > >
> > > > On Fri, May 2, 2008 at 9:12 PM, Nikolas Everett <nik9000@gmail.com>
> > > > wrote:
> > > >
> > > >  I'm interested in hacking on OpenJPA a little.  I downloaded the
> > > > > nightly
> > > > > snapshot, but it doesn't compile on a fresh install of maven:
> > > > >
> > > > >
> > > > > /home/nik/Documents/Programming/OpenJPA/apache-openjpa-1.1.0-SNAPSHOT-source/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/DelegatingConnection.java:[47,7]
> > > > > org.apache.openjpa.lib.jdbc.DelegatingConnection is not abstract
> > > > > and does
> > > > > not override abstract method
> > > > > createStruct(java.lang.String,java.lang.Object[]) in
> > > > > java.sql.Connection
> > > > >
> > > > >
> > > > > /home/nik/Documents/Programming/OpenJPA/apache-openjpa-1.1.0-SNAPSHOT-source/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/DelegatingDatabaseMetaData.java:[31,7]
> > > > > org.apache.openjpa.lib.jdbc.DelegatingDatabaseMetaData is not
> > > > > abstract and
> > > > > does not override abstract method
> > > > >
> > > > > getFunctionColumns(java.lang.String,java.lang.String,java.lang.String,java.lang.String)
> > > > > in java.sql.DatabaseMetaData
> > > > >
> > > > >
> > > > > /home/nik/Documents/Programming/OpenJPA/apache-openjpa-1.1.0-SNAPSHOT-source/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/DelegatingStatement.java:[37,7]
> > > > > org.apache.openjpa.lib.jdbc.DelegatingStatement is not abstract
> > > > > and does not
> > > > > override abstract method isPoolable() in java.sql.Statement
> > > > >
> > > > >
> > > > > /home/nik/Documents/Programming/OpenJPA/apache-openjpa-1.1.0-SNAPSHOT-source/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/DelegatingPreparedStatement.java:[51,7]
> > > > > org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement is not
> > > > > abstract and
> > > > > does not override abstract method setNClob(int,java.io.Reader) in
> > > > > java.sql.PreparedStatement
> > > > >
> > > > >
> > > > > /home/nik/Documents/Programming/OpenJPA/apache-openjpa-1.1.0-SNAPSHOT-source/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/DelegatingResultSet.java:[50,7]
> > > > > org.apache.openjpa.lib.jdbc.DelegatingResultSet is not abstract
> > > > > and does not
> > > > > override abstract method
> > > > > updateNClob(java.lang.String,java.io.Reader) in
> > > > > java.sql.ResultSet
> > > > >
> > > > >
> > > > > /home/nik/Documents/Programming/OpenJPA/apache-openjpa-1.1.0-SNAPSHOT-source/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/DelegatingDataSource.java:[35,7]
> > > > > org.apache.openjpa.lib.jdbc.DelegatingDataSource is not abstract
> > > > > and does
> > > > > not override abstract method isWrapperFor(java.lang.Class<?>)
in
> > > > > java.sql.Wrapper
> > > > >
> > > > >
> > > > > /home/nik/Documents/Programming/OpenJPA/apache-openjpa-1.1.0-SNAPSHOT-source/openjpa-lib/src/main/java/org/apache/openjpa/lib/jdbc/DelegatingCallableStatement.java:[49,7]
> > > > > org.apache.openjpa.lib.jdbc.DelegatingCallableStatement is not
> > > > > abstract and
> > > > > does not override abstract method
> > > > > setNClob(java.lang.String,java.io.Reader)
> > > > > in java.sql.CallableStatement
> > > > >
> > > > > What can I do to get a compiling version?
> > > > >
> > > > >
> > > > >
> > > >
> > --
> > Patrick Linskey
> > 202 669 5907
> >
> >
>

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