From: Brian T. <to...@di...> - 2003-04-23 20:04:26
|
Ah, I found it. It was not found with the search terms that I was = using. But now I'm getting a ClassCastException, seems that the return type = from the driver is an Integer, and I'd like to use a Long, since there are a ton = of files already standardized on that. So I'm wondering, is there any way to use a java.lang.Long as the PK = while using MySQL? I'm generating the descriptor using: * @jboss.unknown-pk * class=3D"java.lang.Long" * column-name=3D"id" * jdbc-type=3D"BIGINT" * sql-type=3D"BIGINT(20)" * @jboss:entity-command name=3D"mysql-get-generated-keys" and the result is: <entity> ... <cmp-field> <field-name>id</field-name> <auto-increment/> </cmp-field> <!-- merge point: jbosscmp-jdbc-load-{0}.xml --> <unknown-pk> <unknown-pk-class>java.lang.Long</unknown-pk-class> <column-name>id</column-name> <jdbc-type>BIGINT</jdbc-type> <sql-type>BIGINT</sql-type> </unknown-pk> <entity-command name=3D"mysql-get-generated-keys"> </entity-command> </entity> Thanks for your efforts with all this Alex! -b > -----Original Message----- > From: Brian Topping=20 > Sent: Wednesday, April 23, 2003 2:08 PM > To: JBoss User List (E-mail) > Subject: [JBoss-user] use of <auto-increment/> in 3.2 CMP >=20 >=20 > Hi all, >=20 > I'm trying to use <auto-increment/> with MySQL and a bit=20 > confused on what > should be returned from ejbCreate on my bean. The accessor=20 > for the PK seems > to still be null during ejbCreate, but returning null from=20 > ejbCreate is > obviously not possible. The table is getting created=20 > properly and a record > is being inserted with the right increment. >=20 > I looked around for release notes on this, a bit through the=20 > source and > through the archives, but haven't come up with enough to=20 > figure it out. =20 >=20 > How do I get the PK that the database should have=20 > autogenerated so I can > return it from ejbCreate? >=20 > thanks, >=20 > Brian >=20 >=20 > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > JBoss-user mailing list > JBo...@li... > https://lists.sourceforge.net/lists/listinfo/jboss-user >=20 |