views:

80

answers:

1

Hello,

I have a method annotated with @PrePersist annotation but I've seen that when this method is executed all my transient attributes (the attributes with the @Transient annotation) are null.

When I debug the applicaion I can see that this transient attributes are not null just before calling the persist() method and when it enters my PrePersist method all transient attributes changes to null.

It also happens with PostPersist methods and I need the transient information in this methods.

Is this behaviour normal? Can I avoid it without saving this information in my database?

If it helps I use Hibernate 3.5 and JPA 2.

Thanks

+1  A: 

This is similar to this question which has a more detailed answer. Basically transient information is lost under the hood. There isn't too much you can do about it.

Pace