In my project I am using oracle sql function to generate the primary keys (our client provides the Database and we are not allowed to change them) the generated id are something like this
prefix-1001, prefix-1002 and so on.
The problem is hibernate only support sequences to generate the PKs. I have taken the reference of Oracle functions using Hibernate but at last it didn't work. I know I can achieve this using Native Sql query but is there any less complex way to do it. I am writing the entity code like this
@Id
@Formula("GETCATEGORYID()")
private int id;
private String name;