You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by David Graham <gr...@yahoo.com> on 2004/06/02 04:46:27 UTC

Re: [DbUtils] Retrieving Auto Generated Keys

--- Mikhail Krivoshein <in...@mikkri.com> wrote:
<snip/>

>I dislike idea to implement independant set of query methods named 
>insert because JDBC doesn't do that.
>And unfornutatly there is no way to implement Object 
>getGeneratedKeys(ResultSetHandler rsh) because
>update closes statement object.

Passing a ResultSetHandler into the update() methods to deal with primary
keys seems reasonable.

>
>Looking forward for comments.
>Also I'd like to ask David about JDBC 3.0 support. How do you plan to 
>support JDBC 3.0 features in DbUtils?

What features specifically do you need support for?  

I haven't confirmed this but I believe we can include a call to
Statement.getGeneratedKeys() and still have DbUtils run on 1.3 JVMs.  You
would have to compile the code on 1.4 but I think as long as you don't try
to invoke getGeneratedKeys() on a 1.3 JVM you'll be ok.

Note that the protected QueryRunner.prepareStatement() method is already
the hook for creating PreparedStatements that will return generated keys
(by passing Statement.RETURN_GENERATED_KEYS into
Connection.prepareStatement()).

>What's about DbUtils Option Pack :-) that will include only them?

I want to keep the releases and builds as simple as possible.  That's why
we use Proxies for the JDBC interfaces (which are incompatible between
versions) instead of concrete implementations:
http://jakarta.apache.org/commons/dbutils/xref/org/apache/commons/dbutils/ProxyFactory.html

David

>Best regards,
>Mikhail Krivoshein


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [DbUtils] Retrieving Auto Generated Keys

Posted by David Graham <gr...@yahoo.com>.
--- Mikhail Krivoshein <in...@mikkri.com> wrote:
> >
> >
> >The best thing to do is open a bugzilla enhancement ticket with a cvs
> diff
> >-u formatted patch of the changes plus test cases.  Before adding this
> we
> >need to be sure it will still run on Java 1.3.
> >
> >David
> >  
> >
> OK. I will prepare this later on this week.
> David, is it enough to test code with JRE 1.3 on my PC?

Yes, it would be good to test out the theory that you could compile the
code on 1.4 using javac's -source and/or -target parameters and run it
successfully on 1.3.  Of course, when you call
Statement.getGeneratedKeys()  on 1.3 it should throw an exception.

David

> 
> Best regards,
> Mikhail Krivoshein
> 




	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [DbUtils] Retrieving Auto Generated Keys

Posted by Mikhail Krivoshein <in...@mikkri.com>.
>
>
>The best thing to do is open a bugzilla enhancement ticket with a cvs diff
>-u formatted patch of the changes plus test cases.  Before adding this we
>need to be sure it will still run on Java 1.3.
>
>David
>  
>
OK. I will prepare this later on this week.
David, is it enough to test code with JRE 1.3 on my PC?

Best regards,
Mikhail Krivoshein


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [DbUtils] Retrieving Auto Generated Keys

Posted by David Graham <gr...@yahoo.com>.
--- Mikhail Krivoshein <in...@mikkri.com> wrote:
> 
> 
> >>I dislike idea to implement independant set of query methods named 
> >>insert because JDBC doesn't do that.
> >>And unfornutatly there is no way to implement Object 
> >>getGeneratedKeys(ResultSetHandler rsh) because
> >>update closes statement object.
> >>    
> >>
> >
> >Passing a ResultSetHandler into the update() methods to deal with
> primary
> >keys seems reasonable.
> >
> So what id your decision? Do you plan to update code with my changes?

The best thing to do is open a bugzilla enhancement ticket with a cvs diff
-u formatted patch of the changes plus test cases.  Before adding this we
need to be sure it will still run on Java 1.3.

David

> 
> >>Looking forward for comments.
> >>Also I'd like to ask David about JDBC 3.0 support. How do you plan to 
> >>support JDBC 3.0 features in DbUtils?
> >>    
> >>
> >
> >What features specifically do you need support for?  
> >
> I just want to know you opinion about how to deal with them. At this 
> moment I need getGeneratedKeys() only.
> But who knows that happens later?
> 
> >I want to keep the releases and builds as simple as possible.  That's
> why
> >we use Proxies for the JDBC interfaces (which are incompatible between
> >versions) instead of concrete implementations:
>
>http://jakarta.apache.org/commons/dbutils/xref/org/apache/commons/dbutils/ProxyFactory.html
> >
> Looks like I misunderstand you here.
> 
> Best regards,
> Mikhail Krivoshein
> 
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [DbUtils] Retrieving Auto Generated Keys

Posted by Mikhail Krivoshein <in...@mikkri.com>.

>>I dislike idea to implement independant set of query methods named 
>>insert because JDBC doesn't do that.
>>And unfornutatly there is no way to implement Object 
>>getGeneratedKeys(ResultSetHandler rsh) because
>>update closes statement object.
>>    
>>
>
>Passing a ResultSetHandler into the update() methods to deal with primary
>keys seems reasonable.
>
So what id your decision? Do you plan to update code with my changes?

>>Looking forward for comments.
>>Also I'd like to ask David about JDBC 3.0 support. How do you plan to 
>>support JDBC 3.0 features in DbUtils?
>>    
>>
>
>What features specifically do you need support for?  
>
I just want to know you opinion about how to deal with them. At this 
moment I need getGeneratedKeys() only.
But who knows that happens later?

>I want to keep the releases and builds as simple as possible.  That's why
>we use Proxies for the JDBC interfaces (which are incompatible between
>versions) instead of concrete implementations:
>http://jakarta.apache.org/commons/dbutils/xref/org/apache/commons/dbutils/ProxyFactory.html
>
Looks like I misunderstand you here.

Best regards,
Mikhail Krivoshein

>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org