cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Key JPA Generator

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

ashutosh_rastogi
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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