Spring Data JPA select sequence for different bases, and set value to entity

I need implement next logic:

I have entity:



@Table(name = "USERS")

public class User {


@Column(name = "GUID")

private String guid;

@Column(name = "MESSAGE_ID")

private String messageId;

@Column(name = "SOME_VALUE")

private String someValue;

And I need set to someValue generated value consisting of

"some preffix"+sequencefrom DB + "some suffix";

I can make select sequense from Db, generate vsomeValue and set it to entity, but maby Is there a way to make it easier? Because in my version I use two bases, and I have to write two native query for select a sequence and use the appropriate one depending on the...

Read More »

By: StackOverFlow - Thursday, 8 November

Related Posts