[
https://issues.apache.org/jira/browse/IBATIS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602610#action_12602610
]
zavisagie edited comment on IBATIS-142 at 6/5/08 3:55 AM:
-------------------------------------------------------------
I have included the following patch: ibatis-jdbc3-patch.txt
It is for adding jdbc3 support and was derived from ibatis 2.3.2. It's a real
hack, since I use a statically accessed ThreadLocal to pass the generated key
across layers of interfaces and is only meant for the desperate (like me). This
is not intended for inclusion in ibatis, but merely to get jdbc3 generated keys
working quickly and works only with jdbc3 prepareStatement( String sql,
String[] columns ) setting a single column in that array.
No config dtd's have been modified and it uses selectKey to pass in the column
name with a prefix:
<selectKey keyProperty="id" resultClass="java.lang.Long">
KEY_COLUMN: mytable_id
</selectKey>
The type attribute is ignored. So pre or post becomes irrelevant in this
scenario.
It was the least intrusive way I could just get it working, and in this way
will still work with abator. All standard features should still work and it
passed all the unit tests.
Please post any bugs in this patch here (if no one minds), until this feature
is properly implemented.
was (Author: zavisagie):
This patch is for adding jdbc3 support and was derived from ibatis 2.3.2. It's
a real hack, since I use a statically accessed ThreadLocal to pass the
generated key across layers of interfaces and is only meant for the desperate
(like me). This is not intended for inclusion in ibatis, but merely to get
jdbc3 generated keys working quickly and works only with jdbc3
prepareStatement( String sql, String[] columns ) setting a single column in
that array.
No config dtd's have been modified and it uses selectKey to pass in the column
name with a prefix:
<selectKey keyProperty="id" resultClass="java.lang.Long">
KEY_COLUMN: mytable_id
</selectKey>
The type attribute is ignored. So pre or post becomes irrelevant in this
scenario.
It was the least intrusive way I could just get it working, and in this way
will still work with abator.
Please post any bugs in this patch here (if no one minds), until this feature
is properly implemented.
> 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-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.