hi,

I'm trying to find out how to declare autogeneration of primary keys in 
jbosscmp-jdbc.xml.

I know how to do this with the databases where this option is supported in 
standardjboss-cmp.xml (like postgre..):

jbosscmp-jdbc:

  |  <entity>
  |      <ejb-name>Item</ejb-name>
  |      <table-name>item</table-name>
  | 
  |      <cmp-field>
  |          <field-name>pk</field-name>
  |          <column-name>pk</column-name>
  |      <auto-increment/>
  |      </cmp-field>
  | ...
  |     <entity-command name="postgresql-fetch-seq">
  |     </entity-command>
  | </entity>
  |  

However, for firebird there's no entity-command defined in 
standardjboss-cmp.xml.

My first guess was, that I should use the generic pk-sql command and insert the 
code to obtain the pk in firberd:

standardjboss-cmp.xml:

  | <entity-command name="pk-sql" 
class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCPkSqlCreateCommand">
  |     <attribute name="pk-sql">GEN_ID(generator_name, 1)</attribute>
  | </entity-command>
  | 

but obviously there's a catch in the fact I don't know the name of the 
generator to use. 

I looked at he code of the other generating methods, and they have a code 
similar to this somewhere inside

  | sequence = entity.getQualifiedTableName()
  | + '_' + SQLUtil.getColumnNamesClause(pkField, new StringBuffer(20))
  | + "_seq";
  | 

So my second quess is, that I might have to write the new entity command by 
hand based upon the code similar as above, or I might create a procedure and 
entity command for each table and call these commands.

Is there someone who could help me to find a neater solution?

Thanks a lot,
-- peter kalina

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3922580#3922580

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3922580


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to