[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2643) Improve Session.refresh() Javdoc to clarify contract

Chris Bredesen (JIRA) noreply at atlassian.com
Tue May 29 15:10:04 EDT 2007


Improve Session.refresh() Javdoc to clarify contract
----------------------------------------------------

                 Key: HHH-2643
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2643
             Project: Hibernate3
          Issue Type: Improvement
          Components: documentation
            Reporter: Chris Bredesen
            Assignee: Chris Bredesen
            Priority: Minor


It is tempting to use refresh() as an "undo" method when it was not designed as such.  The manual is clear about how refresh() should be used, but doesn't mention how it should NOT be used.  Refresh will not work on the following case:

Cat cat = s.get(Cat.class, new Long(1l));
cat.getKittens.add(new Cat());
s.refresh(cat);

It results in this:

2012 ERROR org.hibernate.AssertionFailure  - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: null identifier
	at org.hibernate.engine.EntityKey.<init>(EntityKey.java:39)
	at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:74)

The presence of cascade type REFRESH makes it sound like this should work.  The documentation needs to be more specific about not using refresh() as an undo facility.  Hibernate itself is not a transaction handler.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list