Zero transient attributes

I have a method annotated with @PrePersist annotation, but I saw that when this method is executed, all my transient attributes (attributes annotated with @Transient) are zero.

When I debug the application, I see that these transient attributes are not null before I call the persist () method, and when it enters my PrePersist method, all the transient attributes are changed to zero.

This also happens with PostPersist methods and I need temp data in those methods.

Is this normal behavior? Can I avoid this by not storing this information in my database?

If it helps, I am using Hibernate 3.5 and JPA 2.

thanks

+2


a source to share


1 answer


It is similar to this question , which has a more detailed answer. Essentially, temporary information is lost under the hood. There is too little you can do about it.



+2


a source







All Articles