[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3069) ObjectNotFoundException when proxy exists for super class of non existant joined subclass

dan oxlade (JIRA) noreply at atlassian.com
Thu Jan 17 08:09:55 EST 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29351 ] 

dan oxlade commented on HHH-3069:
---------------------------------

The reason we have come across this issue is because we are using a zero for a null relationship (this is because of a legacy data model but also because we want to index these columns)
In terms of our data model this situation is not inconsistent because a zero means there is no relationship.

Referencing an id which doesn't exist in other cases would give inconsistencies I can see that.

But I guess this is why the problem arises.

> ObjectNotFoundException when proxy exists for super class of non existant joined subclass
> -----------------------------------------------------------------------------------------
>
>                 Key: HHH-3069
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3069
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.5
>            Reporter: dan oxlade
>
> A proxy of an entity which has a joined subclass is loaded into the session.
> If the proxy resolves to null, i.e the id of the proxy has no matching row in the database then future queries (in the same hibernate session) for any of the joined subclass entities will fail with ObjectNotFoundExceptions from the returnNarrowedProxy method of the DefaultLoadEventListener.
> the following test method in JoinedSubclassTest demonstrates the failing test:
> 	
> 	public void testProxyLoadedWhichDoesNotExist() throws Exception {
> 		Session s = openSession();
> 		Transaction t = s.beginTransaction();
> 		
> 		Long id = Long.valueOf(0L);
> 		Employee employee = (Employee) s.get(Employee.class,id);
> 		assertNull(employee);
> 		
> 		Person proxy = (Person) s.load(Person.class,id);
> 		assertNotNull(proxy);
> 		
> 		employee = (Employee) s.get(Employee.class,id);
> 		assertNull(employee);
> 		
> 		t.commit();
> 		s.close();
> 	}

-- 
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