Spring JPA How to ignore a field in HTTP request when creating new DB object?

This page summarizes the projects mentioned and recommended in the original post on /r/learnjava

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • MapStruct

    An annotation processor for generating type-safe bean mappers

  • It is best if you avoid this altogether. You shouldn't expose your entities directly to the outside world since there is always a chance that your entity contains a proxy object which can mess up the serialization/deserialization process. You may also end up with entity classes that are bloated with annotations. You should define a separate class with every field that needs to be seen/set from the outside and expose it through your APIs. This class is usually called AccountDTO or just Account if your entities' names end with "Entity" (AccountEntity, for example). If you don't like writing boilerplate converters between DTOs and entities, check out MapStruct. An annotation processor library (similar to Lombok, which you are currently using) that provides methods that can simplify conversion between Java classes and beans.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts