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
For entity beans that do not already have a toString() implementation ... Ebean enhancement can provide a good default implementation.
The implementation needs to take into account recursion (e.g. bidirectional parent child relationships) and not invoke any interception or lazy loading.
Lazy loading / no interception
This isn't really a thing/issue. Ebean enhancement already ensures that there is no interception with any toString() implementation. Just stating it for completeness and to be explicit.
Recursion
This is a thing that we hit most of the time with entity beans so important and good that this deals with it. A lot of entities have the classic bidirectional parent -> OneToMany -> children ... with those children having the ... child -> ManyToOne -> parent. So a naive toString implementation would often result in an infinite loop (just like for example JSON serialisation). So it's good that this implementation deals with this.
Note that the @0 is the bean 'index' value of zero. When we get recursion, the content isn't repeated but instead includes something like Customer@0 that points back to the bean [that has already been output].
The text was updated successfully, but these errors were encountered:
For entity beans that do not already have a
toString()
implementation ... Ebean enhancement can provide a good default implementation.The implementation needs to take into account recursion (e.g. bidirectional parent child relationships) and not invoke any interception or lazy loading.
Lazy loading / no interception
This isn't really a thing/issue. Ebean enhancement already ensures that there is no interception with any
toString()
implementation. Just stating it for completeness and to be explicit.Recursion
This is a thing that we hit most of the time with entity beans so important and good that this deals with it. A lot of entities have the classic bidirectional parent -> OneToMany -> children ... with those children having the ... child -> ManyToOne -> parent. So a naive toString implementation would often result in an infinite loop (just like for example JSON serialisation). So it's good that this implementation deals with this.
Examples:
Note that the
@0
is the bean 'index' value of zero. When we get recursion, the content isn't repeated but instead includes something likeCustomer@0
that points back to the bean [that has already been output].The text was updated successfully, but these errors were encountered: