[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-4070) createProxy() called even when hasProxy() returns false

Philip Borlin (JIRA) noreply at atlassian.com
Mon Aug 10 14:24:14 EDT 2009


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Philip Borlin updated HHH-4070:
-------------------------------

    Attachment: HHH4070.mapping
                HHH4070.java

Attached is the test file and mapping as requested.  The test file has a standard main method so it can be run from the command line.  Depends on hsqldb but that can be changed to a database of your choice by modifying the setupDatabase() method.  HHH4070.java is in the default package.

Here is the stacktrace that I get when I run the file:
Exception in thread "main" java.lang.UnsupportedOperationException: Does not support proxies
	at HHH4070$BugReportTuplizer.createProxy(HHH4070.java:85)
	at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3469)
	at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:298)
	at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:219)
	at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
	at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:906)
	at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:874)
	at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:590)
	at org.hibernate.type.EntityType.resolve(EntityType.java:412)
	at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139)
	at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
	at org.hibernate.loader.Loader.doQuery(Loader.java:752)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
	at org.hibernate.loader.Loader.doList(Loader.java:2232)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
	at org.hibernate.loader.Loader.list(Loader.java:2124)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
	at HHH4070.main(HHH4070.java:41)


> createProxy() called even when hasProxy() returns false
> -------------------------------------------------------
>
>                 Key: HHH-4070
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4070
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.2
>         Environment: 3.3.2GA, PostgresQL 8.3
>            Reporter: Philip Borlin
>         Attachments: HHH4070.java, HHH4070.mapping
>
>
> This problem occurs when an EntityTuplizer is used.  In my case I throw an UnsupportedOperationException in my createProxy() method.  I would expect that would be ok since my hasProxy() method returns false.  This was working in 3.3.1 but broke in 3.3.2.
> In DefaultLoadEventListener in the proxyOrLoad() method there is a call to persister.hasProxy().  This makes a call to AbstractEntityPersister which simply checks to see whether the entityMetamodel isLazy().
> That check succeeds since lazy is sent to true.
> The next check sees if isAllowProxyCreation() is false in the options.
> Lastly creatProxyIfNecessary() is called which if the entity does not exist calls createProxy() on the persister.  AnstractEntityPersister delegates this directly to the tuplizer.
> At no point was the tuplizer's hasProxy() method ever consulted.

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