Is there any documentation on Hibernate event types?

I usually hesitate to ask a question like this, but I can't seem to find anything useful: is there any documentation on hibernation events, that is, what the events mean when they are thrown, what data they contain, etc. etc.?

Any link or link is greatly appreciated.

To get a list of events I can just take a look at org.hibernate.event.spi.EventType

and from this class I can get the actual event classes. However, the documentation for these classes is rather sparse, and the hibernation user guide or developer guide doesn't provide anything either (just how to register listeners, but it's actually simple).

I already tried to add listeners that just write when they are called, but the order of the output is somewhat confusing and I make assumptions about what is called when it is rather difficult.

Attention . The following example may seem rather long and abstract and is an attempt to illustrate my problem. I'm only talking about two events here, while there are 33 more that seem to be undocumented.

There are 2 listeners:

  • PreloadEventListener - JavaDoc says Called before injecting property values into a newly loaded entity instance.

  • LoadEventListener - JavaDoc says Defines the contract for handling of load events generated from a session.

As you can see, JavaDoc doesn't provide much information, at least for LoadEventListener

. Both events may indeed refer to different situations, but as I said, I couldn't find any documentation.

Listeners also don't always get called in the same order as they appear. I added that both listeners made a few clicks to one of our existing web applications.

Here are the results (abstracted output):

Action 1 exit

preload: entity of type A with id 0

      

Action 2 exit

preload: entity of type A with id 1
load: entity of type A with id 1
preload: entity of type B with id 0

      

Action 3 exit

preload: entity of type C  with id 0
load:    entity of type D  with id 0
load:    entity of type E  with id 0
load:    entity of type F  with id 0
load:    entity of type A  with id 0
preload: entity of type F' with id 0
preload: entity of type A  with id 0
load:    entity of type C  with id 0
...
load:    entity of type A  with id 0
load:    entity of type C  with id 0

      

The description of what we are doing in these activities will be out of scope, but as you can see, we are mainly loading simple objects and more complex structure in activity 3.

As you can see, sometimes only the preload event fires (for example A

in activity 1), sometimes it only fires (for example, F

in activity 3), sometimes there are multiple load events after preloading (for example, C

in activity 3) or even variable loads and preload events (for example, A

in step 3).

F'

will be a subclass F

that can explain F'

post -load preload F

, but other cases are not easy to explain. I'm pretty sure there is a deterministic ordering and a reason why some events are not being fired, but as I originally said, I am missing the documentation to do this.

For everyone who has read this "short" example: I hope this does not confuse you too much. If necessary, I can provide a more specific example, perhaps even simpler, but I have a feeling that these simpler examples provide an easier explanation of the results, while our more complex cases in the real world are still not quite clear. As I said, I'm looking for documentation on 35 Hibernate event types, not a detailed explanation of the case depicted.

+3


source to share





All Articles