|
Hi
Previously my Id filed looks like this @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "idGenerator") //@SequenceGenerator(name = "idGenerator", sequenceName = "HIBERNATE_SEQUENCE", allocationSize = 50) @Column(name = "ID") public Long getId() { return mId; }
But now I want that If I set the Id using xyz.setId(123) Hibernate should not use this SequenceGenerator.
For that I tried using @GenericGenerator(name = "idGenerator", strategy = "com.domain.UseExistingOrGenerateIdGenerator") but I didn't find find a way where I can get the same functionality ns @SequenceGenerator(name = "idGenerator", sequenceName = "HIBERNATE_SEQUENCE", allocationSize = 50) if the Id is not set programatically
I tried a lot but there is noting that helped, please resolve
|