Skip to Content

Custom Key JPA Generator

Hi all,

Using CE 7.1 is possible to define a GENERATOR for a Custom Key on CAF Business Object?

Best regards

Isaías Barroso

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Sep 27, 2008 at 06:03 AM

    Hi,

    CAF does not have any key generator.

    What you can do is, you can create a utility DC of java type. Create a Key Generator class that uses SAP's unique ID generator classes.

    com.sap.guid.GUIDGeneratorFactory 
    com.sap.guid.IGUIDGenerator

    Method to get the key will look like

    public String getUUID() {
            return this.generator.createGUID().toHexString();
    }

    Now use this class in your caf project to generate unique keys.

    Hope this helps,

    Ashutosh

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      Thanks by response, but i will need something like :

      @Id
              @GeneratedValue(generator="InvTab")
              @TableGenerator(name="InvTab", table="ID_GEN",
                  pkColumnName="ID_NAME", valueColumnName="ID_VAL",
                  pkColumnValue="INV_GEN")
              private long id;

      I wouldn't to implement it, but i will do it on the utility class.

      Best regards

      Isaías Barroso