• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding Statement.RETURN_GENERATED_KEYS in jbosscmp-jdbc.xml  RSS feed

C Va
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am using Xdoclet to generate an EJB. I am trying to migrate from mysql 4 to mysql 5 but I get an error:
Caused by: java.sql.SQLException: Generated keys not requested. You need to specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate() or Connection.prepareStatement().

The question is, how can I specify Statement.RETURN_GENERATED_KEYS to JDBCMySQLCreateCommand?

My jbosscmp-jdbc.xml looks like this:



<entity-command name="mysql-get-generated-keys" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand">
<attribute name="class-name">com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper</attribute>

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!