In the mean time, I made a transient variable in the MyTable class called displayName.
Hopefully there is a better solution?
You are breaking MVC in a bad way. You seem to doing presentation logic inside a session bean. session beans are about business logic. Rather add the additional field on the client side rather then within the session bean itself.
The reason the database is updated is that you are still working within the entity / persistent context as you are still inside the container. If you had to use a remote client (are you using remote or local interfaces ?) then perform the presentation logic in the client code.
I think what he's doing is fine.
The idea that session beans are never used in the presentation tier is oldstyle EJB2 thinking.
To stop a method from persisting changes, mark it @TransactionAttribute(NOT_SUPPORTED).
Excellent, thank you.
FYI, slight change but it should be