I can't get hypersonic to generate primary keys for me in an automated way.
This is what I have in jbosscmp-jdbc.xml <entity> | <ejb-name>StudentGroup</ejb-name> | | <cmp-field> | <field-name>id</field-name> | <auto-increment/> | </cmp-field> | | <cmp-field> | <field-name>password</field-name> | </cmp-field> | | <entity-command name="get-generated-keys"> | </entity-command> in ejb-jar.xml (some fields skipped) <entity> | <ejb-name>StudentGroup</ejb-name> | <persistence-type>Container</persistence-type> | <prim-key-class>java.lang.Integer</prim-key-class> | <reentrant>False</reentrant> | <cmp-version>2.x</cmp-version> | <abstract-schema-name>StudentGroup</abstract-schema-name> | | <cmp-field > | <field-name>id</field-name> | </cmp-field> | | <cmp-field > | <field-name>password</field-name> | </cmp-field> | | <primkey-field>id</primkey-field> | </entity> Everytime I create a new StudentGroup I get a null value for getId (both in ejbCreate() and in ejbPostCreate). Obviously the DB ends up corrupted. What is the correct way to get the autogenerated key? I thought that with autogenerated primary keys all I had to do was to create a simple ejbCreate that ends with return getId();, being the id field already set by the DB. It seems that I am wrong. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3876082#3876082 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3876082 ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ JBoss-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jboss-user
