-->
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.  [ 6 posts ] 
Author Message
 Post subject: Many-to-one mapping, No persister for: java.lang.Long
PostPosted: Fri May 07, 2004 10:44 am 
Beginner
Beginner

Joined: Mon Sep 29, 2003 2:18 pm
Posts: 20
* Hibernate 2.1.2
* Mapping (the one):

<class name="com.cti.portal.tutor.valueobject.CaseStudyAudience" table="CASESTUDY_AUDIENCE">
<id name="audienceTypeId" column="AudienceTypeId" type="long" unsaved-value="0">
<generator class="sequence">
<param name="sequence">AUDIENCETYPEID_SEQ</param>
</generator>
</id>
<property name="audienceType" />


</class>

* Mapping (the many):

<class name="com.cti.portal.tutor.valueobject.CaseStudyGeneral" table="CASESTUDY_GENERAL">
<id name="caseStudyId" column="CaseStudyID" type="long">
<generator class="sequence">
<param name="sequence">CASESTUDYID_SEQ</param>
</generator>
</id>
<property name="caseName" />
<property name="caseDescription" />
<property name="internalCaseId" />
<property name="diseaseState" />
<property name="accessType" />
<property name="facilityId"/>
<property name="caseOfMonth"/>
<property name="caseOfMonthAccessType"/>
<property name="dateCreated"/>
<property name="createdBy"/>
<property name="reviewStatus"/>
<property name="reviewedBy"/>
<property name="reviewDate"/>
<property name="dateModified"/>
<property name="modifiedBy"/>
<property name="referenceInfo"/>


<one-to-one name="patientHistory" cascade="all" class="com.cti.portal.tutor.valueobject.CaseStudyPatientHistory"/>
<one-to-one name="history" cascade="all" class="com.cti.portal.tutor.valueobject.CaseStudyHistory"/>
<one-to-one name="caseOfMonthHistory" cascade="all" class="com.cti.portal.tutor.valueobject.CaseOfMonthHistory"/>

<many-to-one name="audienceTypeId"
class="com.cti.portal.tutor.valueobject.CaseStudyAudience"
column="audiencetypeid"
update="true"
insert="true" />


<set name="findings" table="CASESTUDY_FINDINGS" inverse="true">
<key column="casestudyid"/>
<one-to-many class="com.cti.portal.tutor.valueobject.CaseStudyFindings"/>
</set>

<set name="followups" table="CASESTUDY_FOLLOWUP" inverse="true">
<key column="casestudyid"/>
<one-to-many class="com.cti.portal.tutor.valueobject.CaseStudyFollowUp"/>
</set>

<set name="results" table="CASESTUDY_RESULTS" inverse="true">
<key column="casestudyid"/>
<one-to-many class="com.cti.portal.tutor.valueobject.CaseStudyResults"/>
</set>

<set name="pathologies" table="CASESTUDY_PATHOLOGY" inverse="true">
<key column="casestudyid"/>
<one-to-many class="com.cti.portal.tutor.valueobject.CaseStudyPathology"/>
</set>


</class>

* Java code:

Session session = HibernateUtil.currentSession();
session.save(csg);
session.save(history);
session.flush();
HibernateUtil.closeSession();

* Trace

2004-05-07 10:29:39,745 INFO [STDOUT] Hibernate: select CASESTUDYID_SEQ.nextval from dual
2004-05-07 10:29:39,765 ERROR [STDERR] net.sf.hibernate.MappingException: No persister for: java.lang.Long
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2656)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2663)
at net.sf.hibernate.impl.SessionImpl.isUnsaved(SessionImpl.java:1064)
at net.sf.hibernate.impl.SessionImpl.nullifyTransientReferences(SessionImpl.java:1010)
at net.sf.hibernate.impl.SessionImpl.nullifyTransientReferences(SessionImpl.java:996)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:901)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:839)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:761)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)
at com.cti.portal.tutor.session.casestudy.CaseStudySessionBean.createCaseStudy(CaseStudySessionBean.java:209)
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 org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:104)

* Database: Oracle 8i


Top
 Profile  
 
 Post subject: Question
PostPosted: Fri May 07, 2004 12:44 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 2:18 pm
Posts: 20
I guess I should actually ask a question. Where exactly is it trying to get Long from? It's not in my JavaBeans, and I have the type set to "long".

Thanks,
Steve


Top
 Profile  
 
 Post subject: Cascade?
PostPosted: Fri May 07, 2004 1:09 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 2:18 pm
Posts: 20
It may be a cascade issue. I see the DEBUG log:

Quote:
2004-05-07 13:05:37,471 DEBUG [net.sf.hibernate.impl.SessionImpl] saving [com.cti.portal.tutor.valueobject.CaseStudyGeneral#97]
2004-05-07 13:05:37,471 DEBUG [net.sf.hibernate.engine.Cascades] processing cascades for: com.cti.portal.tutor.valueobject.CaseStudyGeneral
2004-05-07 13:05:37,471 DEBUG [net.sf.hibernate.engine.Cascades] done processing cascades for: com.cti.portal.tutor.valueobject.CaseStudyGeneral
2004-05-07 13:05:37,472 DEBUG [net.sf.hibernate.engine.Cascades] id unsaved-value: 0
2004-05-07 13:05:37,480 ERROR [STDERR] net.sf.hibernate.MappingException: No persister for: java.lang.Long


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 07, 2004 1:10 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 2:18 pm
Posts: 20
When I say a cascade issue, I mean maybe it's one of the other relationships, not the Audience one.

Steve


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 07, 2004 1:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Check your code, I suspect you added a "Long" somewhere to a collection.


Top
 Profile  
 
 Post subject: Duh.
PostPosted: Fri May 07, 2004 2:16 pm 
Beginner
Beginner

Joined: Mon Sep 29, 2003 2:18 pm
Posts: 20
I was using the ID as the field, instead of the Class name. :)
Steve


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

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.