Thats perfectly fine.... its just doing a deep copy, for the purposes of dirty checking, so it doesn't need the parent. Of course it also doesn't need to call setParent()! ;) I will remove that call, but its harmless, so don't worry about it.....
----- Original Message ----- From: "Viktor Szathmary" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 31, 2003 4:07 PM Subject: Re: [Hibernate] hib2 - parent in composite-element > hi, > > On Thu, 30 Jan 2003 23:39:18 -0500, "Viktor Szathmary" > <[EMAIL PROTECTED]> said: > > > alas, i got an IllegalArgumentException: "argument type mismatch" when > > it's calling the setter... it turns out the problem is more of a > > misunderstanding - the <parent> for the nested composite-element is > > actually the outermost <class> according to Hibernate.. > > it seems something else is borked too - when i'm loading the objects, > hibernate first calls the setter to set the proper parent - right after > that it goes and calls the setter with a null... > > i pasted the mapping file below, and two stack traces of the setter being > called... > > <?xml version="1.0"?> > <!DOCTYPE hibernate-mapping PUBLIC > "-//Hibernate/Hibernate Mapping DTD 2.0//EN" > "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> > > <hibernate-mapping> > <class name="net.sf.flock.hibernate.Subscription" table="subscription"> > <id name="id" unsaved-value="null" length="32"> > <generator class="uuid.hex"/> > </id> > > <property name="location" type="net.sf.flock.hibernate.URLType"/> > > <component name="metaData" class="net.sf.flock.MetaData"> > <map name="metaData" table="subscriptionMeta" lazy="false" cascade="all"> > <key column="feed_id"/> > <index column="md_key" type="string" /> > <element column="md_value" type="string" /> > </map> > </component> > > <component name="feed" class="net.sf.flock.hibernate.Feed"> > <parent name="subscription"/> > > <property name="title"/> > > <property name="site" type="net.sf.flock.hibernate.URLType"/> > > <bag name="items" cascade="all"> > <key column="id"/> > <composite-element class="net.sf.flock.hibernate.Item"> > <parent name="origin"/> > <property name="title"/> > <property name="link" type="net.sf.flock.hibernate.URLType"/> > <property name="description"/> > <property name="creationTime" /> > </composite-element> > </bag> > </component> > </class> > > </hibernate-mapping> > > > stack trace of the call with a valid parent: > at net.sf.flock.hibernate.Item.setOrigin(Item.java:32) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at net.sf.hibernate.util.ReflectHelper$Setter.set(ReflectHelper.java:39) > at net.sf.hibernate.type.ComponentType.instantiate(ComponentType.java:211) > at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:130) > at net.sf.hibernate.collection.CollectionPersister.readElement(CollectionPersis ter.java:301) > at net.sf.hibernate.collection.Bag.readFrom(Bag.java:87) > at net.sf.hibernate.loader.Loader.doFind(Loader.java:161) > at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:472) > at net.sf.hibernate.loader.CollectionLoader.initialize(CollectionLoader.java:74 ) > at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2396) > at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentC ollection.java:102) > at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentColle ctionType.java:63) > at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentC ollectionType.java:159) > at net.sf.hibernate.type.PersistentCollectionType.nullSafeGet(PersistentCollect ionType.java:48) > at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:123) > at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:65) > at net.sf.hibernate.loader.Loader.hydrate(Loader.java:348) > at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:298) > at net.sf.hibernate.loader.Loader.doFind(Loader.java:142) > at net.sf.hibernate.loader.Loader.find(Loader.java:487) > at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:951) > at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1146) > at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1125) > at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1121) > at net.sf.flock.hibernate.HibernateSubscriptionManager.loadSubscription(Hiberna teSubscriptionManager.java:72) > at net.sf.flock.hibernate.HibernateSubscriptionManagerTest.testPersistence(Hibe rnateSubscriptionManagerTest.java:51) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at junit.framework.TestCase.runTest(TestCase.java:166) > at junit.framework.TestCase.runBare(TestCase.java:140) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:131) > at junit.framework.TestSuite.runTest(TestSuite.java:173) > at junit.framework.TestSuite.run(TestSuite.java:168) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu nner.java:360) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner. java:246) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner .java:146) > > > and this is when it's calling it with null: > at net.sf.flock.hibernate.Item.setOrigin(Item.java:32) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at net.sf.hibernate.util.ReflectHelper$Setter.set(ReflectHelper.java:39) > at net.sf.hibernate.type.ComponentType.instantiate(ComponentType.java:211) > at net.sf.hibernate.type.ComponentType.deepCopy(ComponentType.java:203) > at net.sf.hibernate.collection.Bag.snapshot(Bag.java:139) > at net.sf.hibernate.collection.PersistentCollection.getSnapshot(PersistentColle ction.java:175) > at net.sf.hibernate.impl.SessionImpl$CollectionEntry.postInitialize(SessionImpl .java:258) > at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2399) > at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentC ollection.java:102) > at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentColle ctionType.java:63) > at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentC ollectionType.java:159) > at net.sf.hibernate.type.PersistentCollectionType.nullSafeGet(PersistentCollect ionType.java:48) > at net.sf.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:123) > at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:65) > at net.sf.hibernate.loader.Loader.hydrate(Loader.java:348) > at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:298) > at net.sf.hibernate.loader.Loader.doFind(Loader.java:142) > at net.sf.hibernate.loader.Loader.find(Loader.java:487) > at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:951) > at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1146) > at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1125) > at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1121) > at net.sf.flock.hibernate.HibernateSubscriptionManager.loadSubscription(Hiberna teSubscriptionManager.java:72) > at net.sf.flock.hibernate.HibernateSubscriptionManagerTest.testPersistence(Hibe rnateSubscriptionManagerTest.java:51) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at junit.framework.TestCase.runTest(TestCase.java:166) > at junit.framework.TestCase.runBare(TestCase.java:140) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:131) > at junit.framework.TestSuite.runTest(TestSuite.java:173) > at junit.framework.TestSuite.run(TestSuite.java:168) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu nner.java:360) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner. java:246) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner .java:146) > > -- > http://fastmail.fm - Same, same, but different... > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > hibernate-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/hibernate-devel ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel