[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3129) Null Role in PersitentCollection during a onCollectionRecreate() in an Interceptor

Marcelo Alves (JIRA) noreply at atlassian.com
Thu Jul 17 16:36:47 EDT 2008


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

Marcelo Alves commented on HHH-3129:
------------------------------------

Gail,

I'm facing the same problem as CHILLAN reported. Is there another way to discovery the node "name" of a collection inside the "onPostRecreateCollection" of PostCollectionRecreateEventListener?

Inside the "onPostRemoveCollection" of PostCollectionRemoveEventListener everything is fine and I can get the node with no problem.

The code in the "onPostRecreateCollection" method wich I have problem is

     public void onPostRecreateCollection(PostCollectionRecreateEvent e) {

                .....
		Collection c = hibernateConfiguration.getCollectionMapping(e.getCollection().getRole());
		Table t = c.getCollectionTable();
		System.out.println("Tabela: " + t.getName());
		
		Iterator it = e.getCollection().entries(e.getSession().getFactory().getCollectionPersister(e.getCollection().getRole()));
		
		for (;it.hasNext();) {
			System.out.println("Removendo... " + it.next().toString());
		}
		........
		
		
	}

The "e.getCollection().getRole()" call returns null.

Thanks

> Null Role in PersitentCollection during a onCollectionRecreate() in an Interceptor
> ----------------------------------------------------------------------------------
>
>                 Key: HHH-3129
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3129
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.6
>         Environment: Any
>            Reporter: Jose CHILLAN
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> When the "onCollectionRecreate" is invoked on an Interceptor, the getRole() method returns null. After investigation, 
> the problem is located in the class CollectionEntry in one of its constructors and is easily solved using the patch :
> public CollectionEntry(CollectionPersister persister, PersistentCollection collection) 
> {
>   // new collections that get found + wrapped
>   // during flush shouldn't be ignored
>   ignore = false;
>   collection.clearDirty(); //a newly wrapped collection is NOT dirty (or we get unnecessary version updates)
>   snapshot = persister.isMutable() ?  collection.getSnapshot(persister) : null;
>   // -- ADDED LINE HERE --
>   role = persister.getRole();
>   collection.setSnapshot(loadedKey, role, snapshot);
> }
> Thanks

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