Results 1 to 2 of 2
  1. #1
    Marcus is offline Member
    Join Date
    Jun 2007
    Posts
    92
    Rep Power
    0

    Default Create entity field SEQUENCE oracle

    I am creating an application with ejb and I tried to use the creation of id's of the tables handled by the data base, the idea is to make a auto_incremental of type SEQUENCE.
    The problem of this is I don't know how can associate this to a bean of entity, so that at the time of doing create(), this it creates a registry in the data base with new primary key. I am using CMP Entity 2,0, in the 5.1.2 WSAD and Oracle.

    Marcus:cool:

  2. #2
    Felissa is offline Member
    Join Date
    Jun 2007
    Posts
    95
    Rep Power
    0

    Default RE: Create entity field SEQUENCE oracle

    The sequence of the Entity you have it to give, that is to say, create the sequence in Oracle and later you put it in the description of the EJB, in where the Entity is described to which you want to make reference

    Please check this example:

    in description weblogic-cmp-rdbms-jar.xml you must add the code in bold

    Java Code:
      <weblogic-rdbms-bean> 
        <ejb-name>CertificatesTariffEjb</ejb-name>
    
        <data-source-name>DSUPGElectronic</data-source-name> 
        <table-map> 
          <table-name>CETA</table-name> 
          <field-map> 
            <cmp-field>cetaId</cmp-field> 
            <dbms-column>CETA_ID</dbms-column> 
          </field-map> 
          <field-map> 
            <cmp-field>cetaNumerocertificados</cmp-field> 
            <dbms-column>CETA_NUMBERCERTIFICATES</dbms-column> 
          </field-map> 
          <field-map> 
            <cmp-field>cetaTarifaminima</cmp-field> 
            <dbms-column>CETA_PRICESMINIM</dbms-column> 
          </field-map> 
          <field-map> 
            <cmp-field>trmoId</cmp-field> 
            <dbms-column>SGDT_ID</dbms-column> 
          </field-map> 
        </table-map> 
           <automatic-key-generation> 
          <generator-type>Oracle</generator-type> 
          <generator-name>CETA_SEQ</generator-name> 
          <key-cache-size>1</key-cache-size> 
        </automatic-key-generation> 
      </weblogic-rdbms-bean>
    Felissa:p

Similar Threads

  1. Replies: 0
    Last Post: 02-14-2008, 11:00 AM
  2. Using escape sequence with like clause (%)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-14-2008, 10:57 AM
  3. Using escape sequence with like clause (_)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-14-2008, 10:55 AM
  4. Escape sequence problem
    By eva in forum New To Java
    Replies: 2
    Last Post: 01-21-2008, 11:15 PM
  5. Replies: 1
    Last Post: 07-24-2007, 01:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •