Sorry my previous post was unfinished.
Changing the code resulted to a class cast exception:
Code:
Hibernate: select country0_.countryId as countryId0_, states1_.stateId as stateId1_, country0_.shortName as shortName7_0_, country0_.name as name7_0_, country0_.comments as comments7_0_, country0_.isActive as isActive7_0_, country0_.isDefault as isDefault7_0_, country0_.editDate as editDate7_0_, country0_.editUser as editUser7_0_, states1_.shortName as shortName47_1_, states1_.name as name47_1_, states1_.comments as comments47_1_, states1_.isActive as isActive47_1_, states1_.isDefault as isDefault47_1_, states1_.editDate as editDate47_1_, states1_.editUser as editUser47_1_, states1_.countryId as countryId47_1_, states1_.countryId as countryId0__, states1_.stateId as stateId0__ from country country0_ left outer join state states1_ on country0_.countryId=states1_.countryId where country0_.isActive=true and states1_.isActive=true order by country0_.name, states1_.name
Exception in thread "AWT-EventQueue-0" org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of wresponse.domain.Country.setStates
at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:217)
at org.hibernate.tuple.PojoTuplizer.setPropertyValues(PojoTuplizer.java:187)
at org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2945)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:115)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:791)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221)
at org.hibernate.loader.Loader.doList(Loader.java:1858)
at org.hibernate.loader.Loader.list(Loader.java:1842)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:407)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:273)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:850)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at wresponse.sqltest.SqlTesterForm.execute(SqlTesterForm.java:49)
at wresponse.sqltest.SqlTesterForm.access$000(SqlTesterForm.java:19)
at wresponse.sqltest.SqlTesterForm$1.actionPerformed(SqlTesterForm.java:33)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1766)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: net.sf.cglib.beans.BulkBeanException: org.hibernate.collection.PersistentSet
at wresponse.domain.Country$$BulkBeanByCGLIB$$5dd4bf52.setPropertyValues(<generated>)
at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:214)
... 39 more
Caused by: java.lang.ClassCastException: org.hibernate.collection.PersistentSet
... 41 more