Java Mailing List Archive

http://www.gg3721.com/

Home » the NHibernate development list »

[NHibernate-development] Cascades and anything

Jesse Napier

2008-01-17

Replies: Find Java Web Hosting

Author LoginPost Reply

Is anybody familiar with the Cascades class in the Engine namespace?   Most of the static Cascade methods on that class all take a parameter of type object called “anything”.  There is no documentation on what this parameter is supposed to be. Sometimes a LockMode is passed, sometimes a ReplicationMode and more often then not a null value.  The ActionLockClass will then eventually try and cast “anything” as LockMode and then call Lock on the event source.

 

Besides the non descriptive name of “anything”, the main problem is that eventually a null “anything” makes it to AbstractLockUpgradeEventListener.UpgradeLock, as requestedLockMode. There are no null checks on the requestedLockMock and eventually the code will blow up with a null reference exception if an object graph with cascades is reassociated to a session.

 

It looks like adding a null check inside of UpgradeLock would fix the problem with passing null values as the LockMode, but the upgrade lock and cascade code has been alive for quite a while, (UpgradeLock was simply moved from sessionImpl to AbstractLockUpgradeEventListener when the event framework was inserted), so I’m not sure if this is the correct approach, since at one point in time passing in null for “anything” seemed like a good thing to do. 

 

Does anybody really know what “anything” is supposed to be? 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nhibernate-development mailing list
Nhibernate-development@(protected)
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
©2008 gg3721.com - Jax Systems, LLC, U.S.A.