-
1. Re: Auto primary key generation with CMP and MySQL
milowe Apr 21, 2005 9:44 AM (in response to ian.fallon)Make sure your in jbosscmp-jdbc.xml contains:
<unknown-pk> <unknown-pk-class>java.lang.Integer</unknown-pk-class> <auto-increment/> </unknown-pk> <entity-command name="mysql-get-generated-keys" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand"/>
-
2. Re: Auto primary key generation with CMP and MySQL
ian.fallon Apr 21, 2005 10:25 AM (in response to ian.fallon)Thanks milowe - really appreciate the help - it works find now, you're a star.
Any recommendations of books that might help with the issues that arise between MySQL and JBoss ? Books on either subject don't really cover this area where the two meet.
btw. when the books refer to jbosscmp-jdbc.xml I've been assuming this is actually standardjbosscmp-jdbc.xml in the conf directory, or should I not be editing standardjbosscmp-jdbc.xml with this sort of thing ?
Best regards,
Ian -
3. Re: Auto primary key generation with CMP and MySQL
milowe Apr 22, 2005 3:47 AM (in response to ian.fallon)I dont know of any books focusing in integration MySQL and JBoss, but I am sure they are out there. Reading the manuals of MySQL and JBoss will get you far though. The fun part is then to figure out how to get it to work :) There is no magic about MySQL, it is used like all other data source in JBoss The file standardjbosscmp-jdbc.xml holds definition for the default data source and type mappings between Java, JDBC and the SQL servers being used. This is a server config file. Your deployment specific CMP<->MySQL mappings go into jbosscmp-jdbc.xml in your deployment archive. Preferably you use xdoclet to generate the jbosscmp-jdbc.xml file for you, it makes it a lot easier.
? * @jboss.persistence * datasource = "java:/MySqlDS" * datasource-mapping = "mySQL" * pk-constraint = "true" * * @jboss.unknown-pk * class="java.lang.Integer" * auto-increment="true" * * @jboss.entity-command * name="mysql-get-generated-keys" * class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand" ?
Good luck! -
4. Re: Auto primary key generation with CMP and MySQL
amit10may Apr 28, 2005 1:47 AM (in response to ian.fallon)Hi guys,
I think my problem is similar to yours. But I am using CMR in addition.
The primary key generation works fine when I done use relationships.
Can you help me out by viewing the post which describes the issue.
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3875593#3875593
Regards,
Amit -
5. Re: Auto primary key generation with CMP and MySQL
robr May 9, 2005 3:29 PM (in response to ian.fallon)Could somebody please post the full contents of the jbosscmp-jdbc.xml and ejb-jar.xml files that contain an example of how to use an identity column as a primary key in an entity bean? Also would you please post the script that was used to create the table? I am trying to do this with a table in mssql and have had no luck so far.