[JBoss-user] [EJB 3.0] - Re: Entity comparison

2006-04-25 Thread ejb3workshop
You might want to have a look at using versioning: | @Version | public int getVersion() | { | return version; | } | public void setVersion(int version) | { | this.version=version; | } | Depending on what you need to do you could use the version to see if there have

[JBoss-user] [EJB 3.0] - Re: Entity comparison

2006-04-24 Thread d11w9t
I don't think it is possible to use @AroundInvoke within an entity. I started to write an AOP interceptor which can intercept all set methods for a class annotated with @Entity. This would allow me to do something similar to your example. However I think that this would have a bigger overhead

[JBoss-user] [EJB 3.0] - Re: Entity comparison

2006-04-23 Thread wolfc
How about: @AroundInvoke |public Object myBeanInterceptor(InvocationContext ctx) throws Exception |{ | if (ctx.getMethod().getName().startsWith(set)) | { | // FIXME: set that field to dirty | // Don't forget to compare | } | |

[JBoss-user] [EJB 3.0] - Re: Entity comparison

2006-04-21 Thread wolfc
Note that the PreUpdate callback can be called anytime within your transaction (EJB3 PFD 3.4.2). Try the following: @PostLoad | protected void clearBits() { |userIdChanged = false; | } | | @PostPersist | protected void possiblyNotifyUser() { |if(userIdChanged)

[JBoss-user] [EJB 3.0] - Re: Entity comparison

2006-04-21 Thread d11w9t
This code does work, but I am looking for something more generic as I will need to perform various different tasks for different fields on different entities. To determine whether any field has changed on any entity, I would potentially have to add code to all my set methods to flag the field