UUID Generation

I need to auto generate a UUID into one of the fields while performing XML → Database transformation.

The database table contains a primary key, and other data fields. The primary key field is a UUID.

Product Table
PK → product_id - UUID
sku - String
name - String

Is there a component or some way by which I can generate the UUID while putting in data into the database?

Regards
Pankaj

Hi,
you can use a Reformat component with your own Java transformation for this. In the Java transformation you can generate the UUID by using the standard Java UUID class.

Jaro

Thanks Jurban.

I looked at the Reformat component, and yes I do agree with you we can do it via defining custom transform class, but I went around a little different approach to solving this issue.

My database is postgreSQL, which does not natively have a UUID generation capability. I have loaded the ossp module for generating uuid and having functions generate it, by definining those functions as default value for the primary key fields. This would have the following pros and cons

Pros
1. No additional overhead to reformat huge chunks of data.

Cons
1. Sharing of UUID information in branched out edges will not be possible.

Thanks again Jurban for the prompt support