Hello,

I've a problem with PostPersist callbacks. I discovered that these callbacks 
are invoked within the persist method of the entitymanager (see stacktrace). As 
I read the specification they should be called after a call to persist. 

The problem is, that after a call to EntityManager.persist an 
Id(generate=GeneratorType.AUTO) is set to a valid value. Before that, for 
example within a PostPersist callback the id is unset and invalid.

In my opinion this should be considered a bug, but if it is not, then what is 
the difference between PrePersist and PostPersist callbacks?

I'm not sure whether this is the right location to post this. If it is not, 
please tell me where to send it otherwise.

Milan Wölke


  | ObservableEntityMonitor.notifyObservers4Insert(ObservableEntity) line: 
125--> the PostPersist callback method.
  | NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
available [native method]
  | NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
  | DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
  | Method.invoke(Object, Object...) line: 585
  | ListenerCallback.invoke(Object) line: 25
  | EntityCallbackHandler.callback(Callback, Object) line: 75
  | EntityCallbackHandler.postCreate(Object) line: 49
  | EJB3PostInsertEventListener.onPostInsert(PostInsertEvent) line: 25
  | EntityIdentityInsertAction.postInsert() line: 67
  | EntityIdentityInsertAction.execute() line: 52
  | ActionQueue.execute(Executable) line: 243
  | 
EJB3PersistEventListener(AbstractSaveEventListener).performSaveOrReplicate(Object,
 EntityKey, EntityPersister, boolean, Object, EventSource) line: 269
  | EJB3PersistEventListener(AbstractSaveEventListener).performSave(Object, 
Serializable, EntityPersister, boolean, Object, EventSource) line: 167
  | 
EJB3PersistEventListener(AbstractSaveEventListener).saveWithGeneratedId(Object, 
String, Object, EventSource) line: 101
  | 
EJB3PersistEventListener(DefaultPersistEventListener).entityIsTransient(PersistEvent,
 Map) line: 131
  | 
EJB3PersistEventListener(DefaultPersistEventListener).onPersist(PersistEvent, 
Map) line: 87
  | 
EJB3PersistEventListener(DefaultPersistEventListener).onPersist(PersistEvent) 
line: 38
  | SessionImpl.firePersist(PersistEvent) line: 589
  | SessionImpl.persist(String, Object) line: 567
  | EntityManagerImpl(AbstractEntityManagerImpl).persist(Object) line: 130
  | InjectedEntityManager.persist(Object) line: 97--> the call to persist.
  | PartnerManagerBean.insertOrUpdateRecordOrganisation(Record) line: 206
  | NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
available [native method]
  | NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
  | DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
  | Method.invoke(Object, Object...) line: 585
  | PartnerManagerBean(ServerBean).executeService(ServiceKey, Object[], 
String[], Integer) line: 215 (out of synch)
  | NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
available [native method]
  | NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
  | DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
  | Method.invoke(Object, Object...) line: 585
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 109
  | AllowedOperationsInterceptor.invoke(Invocation) line: 32
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | Ejb3TxPolicy(TxPolicy).invokeInCallerTx(Invocation, Transaction) line: 113
  | TxInterceptor$Required.invoke(Invocation) line: 138
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | TxPropagationInterceptor.invoke(Invocation) line: 61
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | StatelessInstanceInterceptor.invoke(Invocation) line: 39
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | Ejb3AuthenticationInterceptor(AuthenticationInterceptor).invoke(Invocation) 
line: 63
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | ENCPropagationInterceptor.invoke(Invocation) line: 32
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | AsynchronousInterceptor.invoke(Invocation) line: 91
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | StatelessContainer.localInvoke(Method, Object[], FutureHolder) line: 148
  | StatelessLocalProxy.invoke(Object, Method, Object[]) line: 60
  | $Proxy207.executeService(ServiceKey, Object[], String[], Integer) line: not 
available
  | ServiceControlBean.executeService(ServiceKey, Object[], String[], Integer) 
line: 77
  | NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
available [native method]
  | NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
  | DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
  | Method.invoke(Object, Object...) line: 585
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 109
  | AllowedOperationsInterceptor.invoke(Invocation) line: 32
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | Ejb3TxPolicy(TxPolicy).invokeInOurTx(Invocation, TransactionManager) line: 
66
  | TxInterceptor$Required.invoke(Invocation) line: 134
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | TxPropagationInterceptor.invoke(Invocation) line: 61
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | StatelessInstanceInterceptor.invoke(Invocation) line: 39
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | Ejb3AuthenticationInterceptor(AuthenticationInterceptor).invoke(Invocation) 
line: 63
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | ENCPropagationInterceptor.invoke(Invocation) line: 32
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | AsynchronousInterceptor.invoke(Invocation) line: 91
  | EJBContainerInvocation(MethodInvocation).invokeNext() line: 98
  | StatelessContainer.dynamicInvoke(Object, Invocation) line: 189
  | Dispatcher.invoke(Invocation) line: 107
  | AOPRemotingInvocationHandler.invoke(InvocationRequest) line: 69
  | SocketServerInvoker(ServerInvoker).invoke(InvocationRequest) line: 566
  | SocketServerInvoker(ServerInvoker).invoke(Object) line: 436
  | ServerThread.processInvocation() line: 247
  | ServerThread.dorun() line: 285
  | ServerThread.run() line: 169
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3915818#3915818

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3915818


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to