Leon
11/17/2019, 8:43 PMHullaballoonatic
11/17/2019, 8:46 PMnfrankel
11/17/2019, 8:57 PMHullaballoonatic
11/17/2019, 9:45 PMCzar
11/17/2019, 9:47 PMnfrankel
11/18/2019, 6:27 AMnfrankel
11/18/2019, 6:28 AMthanksforallthefish
11/18/2019, 7:14 AMMike
11/18/2019, 11:58 AMuserRepository.save(user)
that I didn't even consider adding save
to the User class.Ben Madore
11/18/2019, 2:39 PM@Repository
into an @Entity
is a feature.
If you are looking to do an ActiveRecord type pattern, then you probably do not want to use the Repository abstraction in the first place (and you’ll be, imo, conflating separate tiers of your architecture).
In the Repository pattern, there is a distinction between the Entities being persisted (data class) and the classes that actually interact with the database (Repositories). It enforces a nice separation of concerns. IMO if you start doing things within the Entity itself, then you’ve also just made proper transaction boundaries much more difficult to define and/or understand onc ethey’re defined.nfrankel
11/18/2019, 3:36 PM@Entity
some refer to as a data structure
which is not OOP
so this pattern of yours is an anti-pattern to othersBen Madore
11/18/2019, 6:11 PM@Entity
and @Repository
and has an architectural specific distinction between the twoBen Madore
11/18/2019, 6:12 PMnfrankel
11/18/2019, 6:25 PMHullaballoonatic
11/18/2019, 6:41 PM