[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2009-03-24 Thread Clinton Begin (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12688679#action_12688679
 ] 

Clinton Begin commented on IBATIS-142:
--

iBATIS 3 has proper support for generated keys.  Unfortunately it was an 
afterthought for so many JDBC drivers (still is -- even for Derby, the "Java 
DB"!),  that it became an afterthought of ours as well.

> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
> Attachments: 2008-03-31-inwork.patch, ibatis-2.3.4.726-src.diff, 
> ibatis-jdbc3-patch.txt
>
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2009-03-24 Thread Zach Visagie (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12688590#action_12688590
 ] 

Zach Visagie commented on IBATIS-142:
-


Thanks Derek, I also discovered the type conversion issue some issues here and 
there. I forgot to contribute it back to this page though, but I'll have a look 
sometime. It would be great if some of the ibatis devs had a look whether it 
might not break some odd/rare scenarios. It's definitely use at own risk!

I realised how much work it would be to do a proper solution, so I do 
understand why it's not been done yet. (:



> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
> Attachments: 2008-03-31-inwork.patch, ibatis-2.3.4.726-src.diff, 
> ibatis-jdbc3-patch.txt
>
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2008-02-24 Thread Brian Diekelman (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571999#action_12571999
 ] 

Brian Diekelman commented on IBATIS-142:


I've been working on the java_release_2.3.0-677 tag.  The trunk appeared to 
have a lot of changes to it and I wanted a clean patch that could be applied to 
the latest release.

The biggest problem thus far is how deep the actual PreparedStatement.execute() 
is called:

SqlMapSessionImpl.insert()
  SqlMapExecutorDelegate.insert()
GeneralStatement.executeUpdate()
  GeneralStatement.sqlExecuteUpdate()
SqlExecutor.executeUpdate()

That last call prepares a PreparedStatement, calls execute(), gets the update 
count, then closes it.  Great for efficiency, bad if we need to get generated 
keys from the PreparedStatement before it's closed.

My plan now is to add: afterExecute(RequestScope request, PreparedStatement) to 
InsertStatement to be called by SqlExecutor.executeUpdate() if the 
MappedStatement in the RequestScope is an instance of InsertStatement.

The majority of my time so far has been finding the most non-intrusive way to 
add this without any unintended consequences affecting the otherwise stable 
codebase.  Hopefully I'll have a couple more hours to work on this over the 
next few days, if not it'll be my project for next weekend.



> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2008-02-22 Thread Venkatt Guhesan (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571608#action_12571608
 ] 

Venkatt Guhesan commented on IBATIS-142:


Hey Brian,

Your game plan sounds good. I'm looking forward to this fix. This will make the 
configuration easier and compatible with the features available in  JDK 1.4. 
I'm a MySQL user but I occasionally use Postgres as well...

Since this feature is not available in Postgresql and pre-JDK 1.4, my 
suggestion would be that if someone tried using this format against Postgresql 
or a database that does not have this feature or a pre-1.4 JDK, then you can 
query the 

boolean java.sql.DatabaseMetaData.supportsGetGeneratedKeys() and if it returns 
a false then you can throw an "UnsupportedFeatureException"
or if the JVM < 1.4 you can throw the same "UnsupportedFeatureException". 

This can potentially eliminate some configuration errors.




> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2008-02-22 Thread Brian Diekelman (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571589#action_12571589
 ] 

Brian Diekelman commented on IBATIS-142:


Alright, I guess somebody has to bite the bullet and create a patch for this... 
 how about this:

Single Generated Key:
Using generated in the 'type' attribute since the other options (pre/post) are 
implied by generated (which has to be post)

insert into user_profiles(first_name_tx)values(#firstName#)




Multiple Generated Keys:
The case of a trigger (or several sql statements if the driver supports it)
with multiple generated keys, this would apply them in order (if we got the 
int[]
back with two entries, id=[0], otherId=[1])


insert into user_profiles(first_name_tx)values(#firstName#)





Code changes

New Classes:
- create a com.ibatis.sqlmap.engine.mapping.statement.GeneratedKeyStatement

Changes to Existing Files:
- com.ibatis.sqlmap.engine.mapping.statement.InsertStatement
  - added a GeneratedKeyStatment[] field + getters/setters
  
- com.ibatis.engine.builder.xml.SqlStatementParser.parseSelectKey()
  - add generated key logic, add to insertStatement
  
- com.ibatis.engine.impl.SqlMapExecutorDelegate
  - line 424, inside insert(SessionScope, String, Object)
- add logic to check for selectKeyStatement/generatedKeyStatement
  
- add 'generated' to 'selectKey' in sql-map-2.dtd


Outstanding questions to think through:
- Throw an exception if we have a selectKey with type 'generated' and no keys 
are generated? (optional setting?)
- Allow a pre/post selectKey *and* a generated selectKey in the same statement?


If I get some halfway decent feedback I might be able to get a patch ready over 
the weekend.  If nothing else, hopefully this will leave a blueprint of what to 
change for the next person if I fail miserably.


> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2008-02-19 Thread Venkatt Guhesan (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570365#action_12570365
 ] 

Venkatt Guhesan commented on IBATIS-142:


I would like to see this feature implemented. And plus now that we are moving 
to Spring's DAO.. Is there something built within Spring that makes this 
feasable?



> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2007-08-28 Thread Clinton Begin (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523443
 ] 

Clinton Begin commented on IBATIS-142:
--

It's only been 2 years man, give us some time!  

LOL.  It should not be a problem now that we've stopped supporting JDK 1.3.  I 
think it's fairly simple, just a matter of finding the time.  

Clinton

> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2007-08-28 Thread Matt Raible (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523402
 ] 

Matt Raible commented on IBATIS-142:


Any update on this issue?

> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2007-03-29 Thread Tony Jewell (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12485363
 ] 

Tony Jewell commented on IBATIS-142:


This is causing impact in my project now and as we are weighing up staying with 
ibatis or moving to Spring Jdbc. Lack of  generated key support could be 
significant.

The using of the SELECT @@identity specific for sybase is annoying and just 
doesn't feel right.

So - yes it would be cool. You have the return structure from the execute - the 
returned object could be a collection - just some syntactic sugar in the sqlmap 
 JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2007-02-16 Thread Brandon Goodin (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473714
 ] 

Brandon Goodin commented on IBATIS-142:
---

Is there any reason why we can't expand our existing selectKey syntax and add 
an attribute called generatedKeys="true/false/yes/no"?  That way we retain the 
mapping ability and ditch the body. . I know the executeUpdate/execute has 
the potential to return multiple results. But, is that a scenario that will 
happen when using iBATIS?

> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2007-02-16 Thread Claus Ibsen (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473660
 ] 

Claus Ibsen commented on IBATIS-142:


As a early adaptor of iBatis in 2003 I really loved this framework.

Now I have the chance again to work with it and I'm a bit surprised it hasn't 
evolved as much as expected.
Well the foundation from the start was really great, so that could be it ;)

So this get my vote as 1.4 is now WebSphere 5.x standard, and to get these keys 
is something we all have to do.

> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: https://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2006-12-19 Thread Matt Raible (JIRA)
[ 
http://issues.apache.org/jira/browse/IBATIS-142?page=comments#action_12459720 ] 

Matt Raible commented on IBATIS-142:


Niels - do you have a more descriptive example of how you do this?  A blog post 
or wiki-page writeup would be great.

> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: http://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2006-12-19 Thread Clinton Begin (JIRA)
[ 
http://issues.apache.org/jira/browse/IBATIS-142?page=comments#action_12459718 ] 

Clinton Begin commented on IBATIS-142:
--

Niels has an excellent solution.  I never thought of that (oh the shame!).   
${SELECT_KEY} or something like that.

Anyway...

I think it is time we did this, especially now that (as Niels said) 1.4 is 
required (come on people, Java 6 is out!).  

It shouldn't be very hard at all. I'll have a look in the next week.  What the 
heck, I'm on vacation.  ;-)

Cheers,
Clinton


> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: http://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2006-12-18 Thread Niels Beekman (JIRA)
[ 
http://issues.apache.org/jira/browse/IBATIS-142?page=comments#action_12459558 ] 

Niels Beekman commented on IBATIS-142:
--

In theory, this could be implemented since 1.4 is default now. However, not all 
DBMS drivers support this, for example the PostgreSQL driver doesn't. I've been 
using it succesfully with the JTDS MSSQL driver. To overcome hardcoding 
database-specific code, we usually put all auto-increment columns in a 
properties file, which we fill for each supported DBMS.

> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: http://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] Commented: (IBATIS-142) JDBC 3 Generated Keys Support

2006-12-18 Thread Matt Raible (JIRA)
[ 
http://issues.apache.org/jira/browse/IBATIS-142?page=comments#action_12459554 ] 

Matt Raible commented on IBATIS-142:


I'd *love* to get getGeneratedKeys() supported so I don't have to hard-code 
database-specific code to return primary keys in my SQL mapping files.

> JDBC 3 Generated Keys Support
> -
>
> Key: IBATIS-142
> URL: http://issues.apache.org/jira/browse/IBATIS-142
> Project: iBatis for Java
>  Issue Type: Improvement
>  Components: SQL Maps
>Reporter: Brandon Goodin
>Priority: Minor
>
> public int executeUpdate(String sql,int autoGeneratedKeys)
> public boolean execute(String sql,int autoGeneratedKeys)
> public ResultSet getGeneratedKeys()
> We should provide support for jdbc auto generated keys retrieval. This is 
> only available in Java 1.4. So, we would have to throw an 
> UnsupportedFeatureException if 1.3 or earlier was being used.
> Brandon

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira