You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/entity-bean-creation.md
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,58 @@ Before writing entity code, remember:
31
31
32
32
---
33
33
34
+
## Naming Conventions: The D* (Domain) Prefix Pattern
35
+
36
+
Entity beans represent internal domain/persistence model details. It's a common best practice in Ebean projects to use the **D* prefix** (D for Domain) for entity class names.
37
+
38
+
**Why use D* prefix?**
39
+
40
+
1.**Avoid name clashes with DTOs** - Your public API may have `Customer` (DTO), but your entity is `DCustomer` (Domain). They're clearly different.
41
+
2.**Signal intent clearly** - The D prefix immediately tells developers "this is an internal domain class, not part of the public API"
42
+
3.**Clarify conversions** - When converting `DCustomer` → `Customer` (DTO), the direction is obvious
43
+
4.**Separate concerns** - API classes in one package (no prefix), domain classes in another (with D prefix)
0 commit comments