-
1. Re: Should the Java transient keyword affect EJB3 persistenc
bill.burke Aug 2, 2005 4:12 PM (in response to rickmeier)EJB3 persistence doesn't care if the field is marked 'transient' or not. By default all properties are considered persistent...
use the javax.persistence.Transaction annotation on your properties/fields that you don't want mapped -
2. Re: Should the Java transient keyword affect EJB3 persistenc
rickmeier Aug 2, 2005 4:34 PM (in response to rickmeier)I was hoping you would say that.
When we use access=AccessType.FIELD, the EntityManager does indeed ignore the transient Java keyword.
But when we use access=AccessType.PROPERTY, the EntityManager does not persist data members of the entity bean that are marked with the transient Java keyword. Sounds like a bug? -
3. Re: Should the Java transient keyword affect EJB3 persistenc
bill.burke Aug 2, 2005 4:40 PM (in response to rickmeier)If AccessType.PROPERTY, then it finds/discovers the persistent props from setter/getter methods. If AccessType.FIELDS it finds/discovers by reflecting on the fields of the class.
-
4. Re: Should the Java transient keyword affect EJB3 persistenc
rickmeier Aug 10, 2005 8:19 PM (in response to rickmeier)So from the JBoss EJB3 container implementation perspective, would it make sense to rely on the behavior of the transient keyword or not?
Part of what makes me nervous of doing so is that the behavior of the JBoss EntityManager is different depending on whether the entity bean is using field or property based access type. Entity beans persisted with AccessType.PROPERTY, will not persist to the database if the underlying Java data member is a transient data member (Java transient keyword not the @Transient annotation).
The attractive part is that it is a very elegant solution, as long as it isn't an accidental side effect that may disappear in a future release of JBoss.
Would it be possible for the EJB3.0 specification to provide a statement clarifying the behavior? -
5. Re: Should the Java transient keyword affect EJB3 persistenc
epbernard Aug 11, 2005 4:24 AM (in response to rickmeier)The spec is clear, there is no mention of the transient keyword. We've considered this keyword as orthogonal to the ORM persistence.
If the implementation really behave this way, this is a bug: but I do not reproduce it. Check your code, there is probably an issue somewhere.