We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GenericGenerator is deprecated since hibernate 6.5 I defined the id generator
GenericGenerator
public class SnowflakeId { @IdGeneratorType(IdGenerator.class) @Retention(RUNTIME) @Target({FIELD, METHOD}) public @interface Generator { } public static final class IdGenerator implements IdentifierGenerator { @Override public Object generate(SharedSessionContractImplementor session, Object object) { try { return Snowflake.next(); } catch (Exception e) { log.error("Generate snowflake id failed", e); throw new RuntimeException(e); } } } }
And i use it in here
@Getter @Setter @ToString @Entity @Table(name = Constants.DATABASE_TABLE_PREFIX + "organization") @Include public class Organization { @Id @SnowflakeId.Generator private Long organizationId; private String organizationName; }
And i receive
No id provided, cannot persist
The request
### Create POST http://localhost:8080/jsonapi/organization Content-Type: application/vnd.api+json { "data": { "type": "organization", "attributes": { "organizationName": "Apple" } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
GenericGenerator
is deprecated since hibernate 6.5I defined the id generator
And i use it in here
And i receive
The request
The text was updated successfully, but these errors were encountered: