문제

I have an entity that requires a GUID for it's primary key. Ideally, I would like to use a java class to generate the GUID before adding the entity to the database, so that I can control exactly how the GUID is created.

Is it possible to delegate the key generation to a java class with WSO2 DSS? How?

도움이 되었습니까?

해결책

you can try to generate the GUID within the SQL statement, using ORACLE (for example) functions. I guess you will success if the algorithm is not too complex. This way, your insert statement would look like:

Insert into table (c1, c2, ..) values (functions for ID, v2,...)

Although the best practice is to use a trigger before insert which call a database sequence to generate a new guid.

You can also try to make a xslt transformation where you implement the algorithm to generate de guid. You would just have to perform the transformation before calling to dss.

Hope it helps!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top