-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: one-to-many uni directional problem
PostPosted: Wed Jun 08, 2005 4:41 pm 
Newbie

Joined: Wed Jun 08, 2005 4:08 pm
Posts: 1
Problem is I am trying to do a One-to-Many uni directional mapping and get the following exception ' net.sf.hibernate.MappingException: No persister for: java.util.HashSet '

--------------------------------------------------------------------------------------
Hibernate version using : Hibernate 2.1.6

--------------------------------------------------------------------------------------

Mapping documents are as follows
Mapping Doc One:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="uk.gov.kn.ibio.bo.Briefcase" table="BRIEFCASE" schema="IBIO">
<id name="id" column="PK_ID" type="long">
<generator class="sequence">
<param name="sequence">IBIO.SEQ_BRIEFCASE</param>
</generator>
</id>
<property name="name" column="NAME" not-null="true" />
<property name="description" column="DESCRIPTION" not-null="true" />

<!-- uni-directional one-to-many association to Documents -->
<set name="documents" inverse="false" lazy="true" cascade="all" >
<key>
<column name="BR_DOC_FK_ID" />
</key>
<one-to-many class="uk.gov.kn.ibio.bo.Document" />
</set>
</class>
</hibernate-mapping>

Mapping Doc Two :

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="uk.gov.kn.ibio.bo.Document" table="DOCUMENT" schema="IBIO">
<id name="id" column="PK_ID" type="long">
<generator class="sequence">
<param name="sequence">IBIO.SEQ_DOC</param>
</generator>
</id>

<property name="documentReference" column="DOCUMENT_REF" not-null="true"/>
<property name="relvance" column="RELEVANCE" not-null="true"/>
<property name="summary" column="SUMMARY" not-null="true"/>
<property name="title" column="TITLE" not-null="true"/>
<property name="url" column="URL" not-null="true"/>

<many-to-one name="briefcase" column="BR_DOC_FK_ID" not-null="false"/>
</class>

</hibernate-mapping>
--------------------------------------------------------------------------------------
Code between the session open and close the list of documents is alreday added to the briefcase before persisting.

session = sessionFactory.openSession();
transaction = session.beginTransaction();

session.save(briefcase);

transaction.commit();
} catch (HibernateException he) {
he.printStackTrace();
doRollback(transaction);

he.printStackTrace();
throw new UnresolvableStateException(
"Exception While Creating a IBIO SYSTEM " + he.getMessages() + " : " + this.getClass().getName());
} finally {
doClose(session);
}
}
--------------------------------------------------------------------------------------
The Full stack trace is:
net.sf.hibernate.MappingException: No persister for: java.util.HashSet
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2690)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2697)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1382)
at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:952)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at uk.gov.kn.ibio.test.persistence.IBIODomainManagerTest.createBriefcaseForDocs(IBIODomainManagerTest.java:91)
at uk.gov.kn.ibio.persistence.tests.UserPersistenceTest.testCreateDocumentByBriefcase(UserPersistenceTest.java:92)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
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:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
21:30:05,030 DEBUG SessionImpl:585 - transaction completion
21:30:05,030 DEBUG SessionImpl:573 - closing session
21:30:05,030 DEBUG SessionImpl:3336 - disconnecting session
net.sf.hibernate.MappingException: No persister for: java.util.HashSet
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2690)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2697)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1382)
at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:114)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:952)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:779)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at uk.gov.kn.ibio.test.persistence.IBIODomainManagerTest.createBriefcaseForDocs(IBIODomainManagerTest.java:91)
at uk.gov.kn.ibio.persistence.tests.UserPersistenceTest.testCreateDocumentByBriefcase(UserPersistenceTest.java:92)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
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:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
--------------------------------------------------------------------------------------

Name and version of the database you are using:
DB2 8.1
--------------------------------------------------------------------------------------
The generated SQL (show_sql=true): SQL IS BELOW
21:30:04,999 DEBUG BatcherImpl:200 - about to open: 0 open PreparedStatements, 0 open ResultSets
21:30:04,999 DEBUG SQL:226 - values nextval for IBIO.SEQ_BRIEFCASE
Hibernate: values nextval for IBIO.SEQ_BRIEFCASE
21:30:04,999 DEBUG BatcherImpl:249 - preparing statement
21:30:05,015 DEBUG SequenceGenerator:81 - Sequence identifier generated: 1000025
21:30:05,015 DEBUG BatcherImpl:207 - done closing: 0 open PreparedStatements, 0 open ResultSets
21:30:05,015 DEBUG BatcherImpl:269 - closing statement
21:30:05,015 DEBUG SessionImpl:778 - generated identifier: 1000025
21:30:05,015 DEBUG SessionImpl:825 - saving [uk.gov.kn.ibio.bo.Briefcase#1000025]
21:30:05,015 DEBUG Cascades:497 - processing cascades for: uk.gov.kn.ibio.bo.Briefcase
21:30:05,015 DEBUG Cascades:506 - done processing cascades for: uk.gov.kn.ibio.bo.Briefcase
21:30:05,015 DEBUG WrapVisitor:81 - Wrapped collection in role: uk.gov.kn.ibio.bo.Briefcase.documents
21:30:05,015 DEBUG Cascades:497 - processing cascades for: uk.gov.kn.ibio.bo.Briefcase
21:30:05,015 DEBUG Cascades:524 - cascading to collection: uk.gov.kn.ibio.bo.Briefcase.documents
21:30:05,030 DEBUG Cascades:113 - cascading to saveOrUpdate()
--------------------------------------------------------------------------------------

Debug level Hibernate log excerpt:
as above


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.