Timeline for factory methods in JPA entity classes. anti pattern?
Current License: CC BY-SA 4.0
17 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 18, 2024 at 0:57 | history | edited | kommradHomer | CC BY-SA 4.0 | changed the word constructor to factory. it was wrong and confusing |
| May 8, 2024 at 14:48 | comment | added | kommradHomer | @Basilevs the methods are not used by JPA. But the class itself is an entity class that a JPA repository uses | |
| May 8, 2024 at 14:46 | comment | added | Basilevs | This is almost a duplicate of Is it a bad idea to put externally dependent logic in ORM classes? | |
| May 8, 2024 at 12:53 | review | Close votes | |||
| May 23, 2024 at 3:03 | |||||
| May 8, 2024 at 12:19 | comment | added | Basilevs | Let us continue this discussion in chat. | |
| May 8, 2024 at 12:18 | comment | added | candied_orange | @Basilevs do please explain. | |
| May 8, 2024 at 12:17 | comment | added | Basilevs | @candied_orange well, you confused me too :) JPA has requirements on methods it uses, this has nothing to do with opinions. It is a mess of reflection. | |
| May 8, 2024 at 12:15 | comment | added | candied_orange | @Basilevs oh you're right of course. But I've given up arguing with people that assume a method that doesn't use instance state should be static. I could argue that it doesn't use static state either but that just confuses them by making sense. | |
| May 8, 2024 at 12:09 | comment | added | Basilevs | @kommradHomer could you add some fields to the example to demonstrate that JPA is actually used? | |
| May 8, 2024 at 12:08 | comment | added | Basilevs | @candied_orange if instance methods are used as a definition for the serialization format, adding static methods to the mix is icky. Similar to having a mix of generated and authored code. | |
| May 8, 2024 at 11:40 | comment | added | candied_orange | @kommradHomer I don't see constructors. I do see factory methods that use builders. Nothing hinky so far. | |
| May 8, 2024 at 11:38 | comment | added | mtj | Don't concern yourself with patterns. If it fits there, it fits there. And even if you find a valid reason later on to think this is the wrong place, moving a method is a refactoring no-brainer nowadays, as long as you don't publish a publicly accessible library. | |
| May 8, 2024 at 11:28 | history | edited | kommradHomer | CC BY-SA 4.0 | fixed the code sample for more detail |
| May 8, 2024 at 11:28 | comment | added | kommradHomer | it's just pseudo. I'm using java. Added more details now | |
| May 8, 2024 at 11:17 | comment | added | Basilevs | I don't recognise the syntax. What language is this? Groovy? | |
| S May 8, 2024 at 10:55 | review | First questions | |||
| May 8, 2024 at 13:01 | |||||
| S May 8, 2024 at 10:55 | history | asked | kommradHomer | CC BY-SA 4.0 |