question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support immutable entities

See original GitHub issue
  • add an immutable attribute on the @Table annotation
  • introspection to use non default public constructor (probably another impl of BeanFactory)
  • if multiple non default public constructors are found, pick one with @DefaultConstructor. If not found, raise exception
  • forbid setters on fields passed to the non default public constructor
  • on fields that are not passed to non default public constructor, ensure setters are there
  • check that all getters are present

Did I miss something @bric3 @KeepItSimpleStupid

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
KeepItSimpleStupidcommented, Oct 24, 2016

I would also rename the annotation @DefaultConstructor to @EntityCreator (similar to Jackson’s @JsonCreator)

0reactions
doanduyhaicommented, Aug 26, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

@Immutable in Hibernate | Baeldung
In this article, we'll talk about how we can make an entity, collection or attribute Immutable in Hibernate. By default, fields are mutable, ......
Read more >
Support immutable entity updates · Issue #11457 · dotnet/efcore
Issue #10703 covers materialization of entities with constructors, which allows immutable entities to be used with EF Core. However, since these entities ......
Read more >
Immutability and Entity Framework Core - Medium
One core feature is the implementation of the unit of work pattern by supporting, what is usually called, a first level cache. Load...
Read more >
Immutable objects when working with Entity Framework Core
EF Core does support immutability, more specifically it can utilize the constructors of your entities. This enables you to create purely ...
Read more >
Immutable entities and value objects in EF Core! - Fati Iseni
How to implement and persist immutable entities and value object in Entity Framework Core.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found