-->
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.  [ 4 posts ] 
Author Message
 Post subject: "No persister for:java.lang.String"caused by key-m
PostPosted: Tue Aug 03, 2004 11:38 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 4:32 am
Posts: 31
When I use
Code:
<composite-id class="com.dsii.hibernate.po.UserRoleID" name="userRoleID" >
         <key-property name="userNo" column="user_id" type="string"/>
         <key-property name="roleNo" column="role_id" type="string"/>
</composite-id>

every thing is OK.

But when use
Code:
<composite-id class="com.dsii.hibernate.po.UserRoleID" name="userRoleID" >
         <key-many-to-one name="userNo" class="com.dsii.hibernate.po.User" column="user_id"/>
         <key-many-to-one name="roleNo" class="com.dsii.hibernate.po.Role" column="role_id"/>
</composite-id>

I encountered a exception like this:
net.sf.hibernate.MappingException: No persister for: java.lang.String
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2686)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2693)
at net.sf.hibernate.impl.SessionImpl.getEntityIdentifierIfNotUnsaved(SessionImpl.java:2755)
at net.sf.hibernate.type.EntityType.getIdentifier(EntityType.java:66)
at net.sf.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:47)
at net.sf.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:154)
at net.sf.hibernate.loader.Loader.bindPositionalParameters(Loader.java:674)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:713)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:185)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:836)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:856)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2113)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1987)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1916)
at com.dsii.common.hibernate.HibernateUtil.findById(HibernateUtil.java:36)
at com.dsii.hibernate.po.UserRoleTest.main(UserRoleTest.java:38)



Any suggestion will be very appreciated.

Best Wishes.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 03, 2004 11:39 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
The type of your UserRoleID.userNo property is String, but it should be a User.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 03, 2004 11:50 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 4:32 am
Posts: 31
I am a newer here ,but I really appreciate your reply so quickly
Thank you very very ~~~~ much.
I'll try it right away.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 04, 2004 2:47 am 
Beginner
Beginner

Joined: Thu Jul 22, 2004 4:32 am
Posts: 31
I have solved the problem,thanks again.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.